On Containment of Conjunctive Queries with Arithmetic Comparisons

  • Foto Afrati
  • Chen Li
  • Prasenjit Mitra
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2992)

Abstract

We study the following problem: how to test if Q 2 is contained in Q 1, where Q 1 and Q 2 are conjunctive queries with arithmetic comparisons? This problem is fundamental in a large variety of database applications. Existing algorithms first normalize the queries, then test a logical implication using multiple containment mappings from Q 1 to Q 2. We are interested in cases where the containment can be tested more efficiently. This work aims to (a) reduce the problem complexity from Π\(^{P}_{\rm 2}\)-completeness to NP-completeness in these cases; (b) utilize the advantages of the homomorphism property (i.e., the containment test is based on a single containment mapping) in applications such as those of answering queries using views; and (c) observing that many real queries have the homomorphism property. The following are our results. (1) We show several cases where the normalization step is not needed, thus reducing the size of the queries and the number of containment mappings. (2) We develop an algorithm for checking various syntactic conditions on queries, under which the homomorphism property holds. (3) We further reduce the conditions of these classes using practical domain knowledge that is easily obtainable. (4) We conducted experiments on real queries, and show that most of the queries pass this test.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Chaudhuri, S., Krishnamurthy, R., Potamianos, S., Shim, K.: Optimizing queries with materialized views. In: ICDE, pp. 190–200 (1995)Google Scholar
  2. 2.
    Theodoratos, D., Sellis, T.: Data warehouse configuration. In: Proc. of VLDB (1997)Google Scholar
  3. 3.
    Ullman, J.D.: Information integration using logical views. In: Afrati, F.N., Kolaitis, P.G. (eds.) ICDT 1997. LNCS, vol. 1186, pp. 19–40. Springer, Heidelberg (1996)Google Scholar
  4. 4.
    Halevy, A.: Answering queries using views: A survey. Very Large Database Journal (2001)Google Scholar
  5. 5.
    Gupta, A., Sagiv, Y., Ullman, J.D., Widom, J.: Constraint checking with partial information. In: PODS, pp. 45–55 (1994)Google Scholar
  6. 6.
    Klug, A.: On conjunctive queries containing inequalities. Journal of the ACM 35, 146–160 (1988)MATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Chandra, A.K., Merlin, P.M.: Optimal implementation of conjunctive queries in relational data bases. In: STOC, pp. 77–90 (1977)Google Scholar
  8. 8.
    van der Meyden, R.: The complexity of querying indefinite data about linearly ordered domains. In: PODS (1992)Google Scholar
  9. 9.
    Levy, A., Mendelzon, A.O., Sagiv, Y., Srivastava, D.: Answering queries using views. In: PODS, pp. 95–104 (1995)Google Scholar
  10. 10.
    Afrati, F., Li, C., Mitra, P.: Answering queries using views with arithmetic comparisons. In: PODS (2002)Google Scholar
  11. 11.
    Afrati, F., Li, C., Mitra, P.: On containment of conjunctive queries with arithmetic comparisons (extended version). Technical report, UC Irvine (2003)Google Scholar
  12. 12.
    Saraiya, Y.: Subtree elimination algorithms in deductive databases. Ph.D. Thesis, Computer Science Dept., Stanford Univ. (1991)Google Scholar
  13. 13.
    Qian, X.: Query folding. In: ICDE, pp. 48–55 (1996)Google Scholar
  14. 14.
    Kolaitis, P.G., Martin, D.L., Thakur, M.N.: On the complexity of the containment problem for conjunctive queries with built-in predicates. In: PODS, pp. 197–204 (1998)Google Scholar
  15. 15.
    Chandra, A., Lewis, H., Makowsky, J.: Embedded implication dependencies and their inference problem. In: STOC, pp. 342–354 (1981)Google Scholar
  16. 16.
    Cosmadakis, S.S., Kanellakis, P.: Parallel evaluation of recursive queries. In: PODS, pp. 280–293 (1986)Google Scholar
  17. 17.
    Chaudhuri, S., Vardi, M.Y.: On the equivalence of recursive and nonrecursive datalog programs. In: PODS, pp. 55–66 (1992)Google Scholar
  18. 18.
    Shmueli, O.: Equivalence of datalog queries is undecidable. Journal of Logic Programming 15, 231–241 (1993)MATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Wang, J., Maher, M., Toper, R.: Rewriting general conjunctive queries using views. In: 13th Australasian Database Conf. (ADC), Melbourne, Australia, ACS (2002)Google Scholar
  20. 20.
    TPC-H: (2003), http://www.tpc.org/tpch/

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Foto Afrati
    • 1
  • Chen Li
    • 2
  • Prasenjit Mitra
    • 3
  1. 1.National Technical University of AthensAthensGreece
  2. 2.Information and Computer ScienceUniversity of CaliforniaIrvineU.S.A
  3. 3.School of Information Sciences and TechonologyThe Pennsylvania State UniversityUniversity ParkU.S.A

Personalised recommendations