Optimizing Datalog Programs

Datalog programs, i.e, Prolog programs without function symbols, are considered. It is assumed that a variable appearing in the head of a rule must also appear in the body of the rule. The input to a program is a set of ground atoms (which are given in addition to the rules of the program) and, therefore, can be viewed as an assignment of relations to some predicates of the program. Two programs are equivalent if they produce the same result for all possible assignments of relations to the extensional predicates (i.e., the predicates that do not appear as heads of rules). Two programs are uniformly equivalent if they produce the same result for all possible assignments of initial relations to all the predicates (i.e., both extensional and intensional). The equivalence problem for Datalog programs is known to be undecidable. It is shown that uniform equivalence is decidable, and an algorithm is given for minimizing a Datalog program under uniform equivalence. A technique for removing parts of a program that are redundant under equivalence (but not under uniform equivalence) is described. A proof procedure for determining uniform equivalence is developed for the case that databases satisfy some constraints.

[1]  Georg Gottlob,et al.  On the efficiency of subsumption algorithms , 1985, JACM.

[2]  Anthony C. Klug,et al.  Determining View dependencies using tableaux , 1982, TODS.

[3]  Alfred V. Aho,et al.  Equivalences Among Relational Expressions , 1979, SIAM J. Comput..

[4]  Lawrence J. Henschen,et al.  On compiling queries in recursive first-order databases , 1984, JACM.

[5]  Ronald Fagin,et al.  Horn clauses and database dependencies , 1982, JACM.

[6]  David Maier,et al.  Magic sets and other strange ways to implement logic programs (extended abstract) , 1985, PODS '86.

[7]  David Maier,et al.  Testing implications of data dependencies , 1979, SIGMOD '79.

[8]  Carlo Zaniolo,et al.  On the implementation of a simple class of logic queries for databases , 1985, PODS.

[9]  Catriel Beeri,et al.  A Proof Procedure for Data Dependencies , 1984, JACM.

[10]  Jeffrey D. Ullman,et al.  Implementation of logical query languages for databases , 1985, TODS.

[11]  Mihalis Yannakakis,et al.  Equivalences Among Relational Expressions with the Union and Difference Operators , 1980, J. ACM.

[12]  Robert A. Kowalski,et al.  The Semantics of Predicate Logic as a Programming Language , 1976, JACM.

[13]  Stavros S. Cosmadakis,et al.  Parallel evaluation of recursive rule queries , 1985, PODS '86.

[14]  Catriel Beeri,et al.  Equivalence of Relational Database Schemes , 1981, SIAM J. Comput..

[15]  Michael Kifer,et al.  Filtering Data Flow in Deductive Databases , 1986, ICDT.