The magic rewriting focuses on relevant data but suffers from additional rules, predicates, and tuples that are generated in search for the relevant data. Reducing the arity of predicates can cut down the number of such rules, predicates, and tuples by an exponential factor. In this paper, we consider a subclass of linear single-IDB programs and show that the magic rewriting can be decomposed in such a way that it is applied to only programs having smaller arities and fewer recursive rules, without losing the binding capacity. The decomposed rewriting is shown to be much more efficient than the standard one and amenable to distributed and parallel environments. The considered subclass significantly generalizes recursions previously proposed for efficient implementation. The decomposed rewriting and the standard generalized magic rewriting are extended to multi-binding queries in such a way that data relevant to one binding is not necessarily considered as relevant to other bindings. The work in this paper shows the use of tuple ID as an important technique in optimizing logic programs. Copyright 1995 by ACM, Inc.
The abstract is also available as a LaTeX file, a DVI file, or a PostScript file.
Categories and Subject Descriptors: F.4.1 [Mathematical Logic and Formal Languages]: Mathematical Logic -- logic programming; H.2.4 [Database Management]: Systems -- query processing; I.2.3 [Artificial Intelligence]: Deduction and Theorem Proving -- deduction and logic programming
General Terms: Algorithms, Theory
Additional Key Words and Phrases: Arity reduction, bottom-up evaluation, database, deductive database, logic program, magic rewriting, program decomposition