A New Factoring Algorithm for Magic Predicates

  • Xiaoyong Du
  • Zhibin Liu
  • Naohiro Ishii
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1538)


The magic-sets method is a basic query optimization method in the deductive database systems. However, the original magic-sets method may generate large magic predicates for recursive queries. In this case, the evaluation of the magic predicates dominate the whole evaluation cost. Factorized magic sets can limit the sizes of generated magic predicates by splitting some magic predicates. However, it suffers from a new “over-splitting” problem. In this paper, we focus on a problem: what is the best splitting schema for a magic predicate, given a magic program. We propose a hypergraph model to represent the magic program as well as its naive evaluation procedure. An intuition is a magic predicate whose arguments belong to different connected components in infinite number of its generated graphs is considered to be a big one. It thus should be split. Based on the hypergraph model, we propose a new concept, called c-partition, as the best splitting of a magic predicate. Although we still do not know how to construct a c-partition, we define a serial of d[k]-partitions to approximate the c-partition. We prove that d[k]-partition is better then the existing splitting algorithm. Our method is a global splitting strategy for magic predicates, in the sense that it decides whether or not to split a magic predicate by considering the whole program


deductive databases query optimization magic sets factoring 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bancilhon, F., Maier, D., Sagiv, Y., Ullman, J.D.: “Magic Set and Other Strange Ways to Implement Logic Programs”. Proc. ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems(PODS), (1986).Google Scholar
  2. 2.
    Siebes, A. etc.: “Deductive Databases: Challenges, Opportunities and Future Directions (panel discussion)” Proc. Int’l Workshop Logic in Databases, pp. 225–230 (1996)Google Scholar
  3. 3.
    Ramakrishnan, R., and Ullman, J.D.: “A Survey of Deductive Database Systems”, JLP Vol. 23, No. 2, 1995.Google Scholar
  4. 4.
    Minker, J.: “Logic and Databases: A 20 Year Retrospective” Proc. Int’l Workshop Logic in Databases, pp. 3–57 (1996)Google Scholar
  5. 5.
    Sagiv, Y.: “Is There Anything Better Than Magic?”, Proc. North American Conference on Logic Programming, pp. 235–254 (1990).Google Scholar
  6. 6.
    Seki, H: On the Power of Alexander Templates. Proc. ACM SIGACT-SIGMOD-SIGART Symp. Principles of Database Systems(PODS), pp. 150–159 (1989)Google Scholar
  7. 7.
    Sippu, S., Soisalon-Soininen, E.: “An Analysis of Magic Sets and Related Optimization Strategies for Logic Queries”, JACM Vol. 43, No. 6, pp. 1046–1088, (Nov 1996)zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Ullman, J.D.: “Principles of Database and Knowledge-Based Systems”, Vol. 1 and 2, Computer Science Press, New York, (1989).Google Scholar
  9. 9.
    Ullman, J.D.: “Bottom-up Beats Top-down”, Proc. ACM SIGACT-SIGMOD-SIGART Symp. Principles of Database Systems(PODS), pp. 140–149 (1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Xiaoyong Du
    • 1
  • Zhibin Liu
    • 1
  • Naohiro Ishii
    • 1
  1. 1.Department of Intelligence and Computer ScienceNagoya Institute of TechnologyJapan

Personalised recommendations