Abstract
We consider the problems of conjunctive query containment and minimization, which are known to be NP-complete, and show that these problems can be solved in polynomial time for the class of acyclic queries. We then generalize the notion of acyclicity and define a parameter called query width that captures the “degree of cyclicity” of a query: in particular, a query is acyclic if and only if its query width is 1. We give algorithms for containment and minimization that run in time polynomial in nk, where n is the input size and k is the query width. These algorithms naturally generalize those for acyclic queries, and are of practical significance because many queries have small query width compared to their sizes. We show that we can obtain good bounds on the query width of Q using the treewidth of the incidence graph of Q. Finally, we apply our containment algorithm to the practically important problem of finding equivalent rewritings of a query using a set of materialized views.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
Supported by NSF Award CCR-9357849, with matching funds from IBM, Mitsubishi, Schlumberger Foundation, Shell Foundation, and Xerox Corporation.
Supported by NSF grant IRI-92-23405, ARO grant DAAH04-95-1-0192, and USAF contract F33615-93-1-1339.
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
References
A.V. Aho, Y. Sagiv, and J.D. Ullman. Efficient optimization of a class of relational expressions. ACM Transactions on Database Systems, 4(4):435–454, December 1979.
A.V. Aho, Y. Sagiv, and J.D. Ullman. Equivalence of relational expressions. SIAM Journal on Computing, 8(2):218–246, May 1979.
H.L. Bodlaender. A linear time algorithm for finding tree-decompositions of small treewidth. In Proceedings of the 25th ACM Symposium on the Theory of Computing, pages 226–234, 1993.
S. Chaudhuri, R. Krishnamurthy, S. Potamianos, and K. Shim. Optimizing queries with materialized views. In Proceedings of the Eleventh International Conference on Data Engineering, pages 190–200, 1995.
A.K. Chandra and P.M. Merlin. Optimal implementation of conjunctive queries in relational databases. In Proceedings of the Ninth ACM Symposium on Theory of Computing, pages 77–90, 1977.
M.H. Graham. On the universal relation. Technical report, University of Toronto, Ontario, Canada, 1979.
D.S. Johnson and A. Klug. Optimizing conjunctive queries that contain untyped variables. SIAM Journal on Computing, 12(4):616–640, November 1983.
S. Khanna and R. Motwani. Towards a syntactic characterization of PTAS. In Proceedings of the 28th ACM Symposium on the Theory of Computing, 1996.
A.Y. Levy, A.O. Mendelzon, Y. Sagiv, and D. Srivastava. Answering queries using views. In Proceedings of the Fourteenth ACM Symposium on Principles of Database Systems, pages 95–104, 1995.
A.Y. Levy, A. Rajaraman, and J.J. Ordille. Querying heterogeneous information sources using source descriptions. In Proceedings of the 22nd International Conference on Very Large Data Bases, 1996.
A.Y. Levy, A. Rajaraman, and J.D. Ullman. Answering queries using limited external query processors. In Proceedings of the Fifteenth ACM Symposium on Principles of Database Systems, pages 227–237, 1996.
P.A. Larson and H.Z. Yang. Computing queries from derived relations. In Proceedings of the Eleventh International Conference on Very Large Data Bases, pages 259–269, 1985.
X. Qian. Query folding. In Proceedings of the Twelfth International Conference on Data Engineering, 1996.
A. Rajaraman, Y. Sagiv, and J.D. Ullman. Answering queries using templates with binding patterns. In Proceedings of the Fourteenth ACM Symposium on Principles of Database Systems, pages 105–112, 1995.
R.E. Tarjan and M. Yannakakis. Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM Journal on Computing, 13(3):566–579, 1984.
J.D. Ullman. Principles of Database and Knowledge-Base Systems, Volume II: The New Technologies. Computer Science Press, Rockville, MD, 1989.
M. Yannakakis. Algorithms for acyclic database schemes. In Proceedings of the Seventh International Conference on Very Large Data Bases, pages 82–94, 1981.
H.Z. Yang and P.A. Larson. Query transformation for PSJ-queries. In Proceedings of the Thirteenth International Conference on Very Large Data Bases, pages 245–254, 1987.
C.T. Yu and M.Z. Ozsoyoglu. An algorithm for tree-query membership of a distributed query. In Proceedings of IEEE COMPSAC, pages 306–312, 1979.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chekuri, C., Rajaraman, A. (1996). Conjunctive query containment revisited. In: Afrati, F., Kolaitis, P. (eds) Database Theory — ICDT '97. ICDT 1997. Lecture Notes in Computer Science, vol 1186. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-62222-5_36
Download citation
DOI: https://doi.org/10.1007/3-540-62222-5_36
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-62222-2
Online ISBN: 978-3-540-49682-3
eBook Packages: Springer Book Archive