Testing Containment of Conjunctive Queries under Functional and Inclusion Dependencies

Abstract Much of the work to date on the optimization of queries for relational databases has focussed on the case where the only dependencies allowed are functional dependencies. We extend this work to the case where inclusion dependencies are also allowed. We show that there are substantial special cases where the presence of inclusion dependencies does not make the basic problems of optimization any harder than they are when there are no dependencies at all. In particular, we show that the problems of query containment, equivalence, and nonminimality remain in NP when either (a) all dependencies are inclusion dependencies or (b) the set of dependencies is what we call “key-based.” These results assume that infinite databases are allowed. If only finite databases are allowed, new containments and equivalences may arise, as we illustrate by an example, and the problems may be substantialy more difficult. We can, however, prove a “finite controllability” theorem that shows that no such examples exist for case (b), or for (a) when the only inclusion dependencies allowed are those having “width” equal to one.

[1]  E. F. Codd,et al.  A relational model of data for large shared data banks , 1970, CACM.

[2]  Carlo Zaniolo,et al.  Design of relational views over network schemas , 1979, SIGMOD '79.

[3]  Ronald Fagin,et al.  Inclusion Dependencies and Their Interaction with Functional Dependencies , 1984, J. Comput. Syst. Sci..

[4]  David S. Johnson,et al.  Optimizing Conjunctive Queries that Contain Untyped Variables , 1983, SIAM J. Comput..

[5]  Johann A. Makowsky,et al.  Embedded implicational dependencies and their inference problem , 1981, STOC '81.

[6]  Ronald Fagin,et al.  A normal form for relational databases that is based on domains and keys , 1981, TODS.

[7]  John C. Mitchell The Implication Problem for Functional and Inclusion Dependencies , 1984, Inf. Control..

[8]  Anthony C. Klug Entity-Relationship Views over Uninterpreted Enterprise Schemas , 1979, ER.

[9]  Diane C. P. Smith,et al.  Database abstractions: aggregation , 1977, CACM.

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

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

[12]  E. F. Codd,et al.  Extending the database relational model to capture more meaning , 1979, ACM Trans. Database Syst..

[13]  Ashok K. Chandra,et al.  Optimal implementation of conjunctive queries in relational data bases , 1977, STOC '77.

[14]  Alfred V. Aho,et al.  Efficient optimization of a class of relational expressions , 1979, TODS.