Finding Equivalent Rewritings in the Presence of Arithmetic Comparisons

  • Foto Afrati
  • Rada Chirkova
  • Manolis Gergatsoulis
  • Vassia Pavlaki
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3896)


The problem of rewriting queries using views has received significant attention because of its applications in a wide variety of data-management problems. For select-project-join SQL (a.k.a. conjunctive) queries and views, there are efficient algorithms in the literature, which find equivalent and maximally contained rewritings. In the presence of arithmetic comparisons (ACs) the problem becomes more complex. We do not know how to find maximally contained rewritings in the general case. There are algorithms which find maximally contained rewritings only for special cases such as when ACs are restricted to be semi-interval. However, we know that the problem of finding an equivalent rewriting (if there exists one) in the presence of ACs is decidable, yet still doubly exponential. This complexity calls for an efficient algorithm which will perform better on average than the complete enumeration algorithm. In this work we present such an algorithm which is sound and complete. Its efficiency lies in that it considers fewer candidate rewritings because it includes a preliminary test to decide for each view whether it is potentially useful in some rewriting.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Afrati, F.N., Gergatsoulis, M., Kavalieros, T.: Answering queries using materialized views with disjunctions. In: Beeri, C., Bruneman, P. (eds.) ICDT 1999. LNCS, vol. 1540, pp. 435–452. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  2. 2.
    Afrati, F., Li, C., Mitra, P.: Answering queries using views with arithmetic comparisons. In: PODS, pp. 209–220 (2002)Google Scholar
  3. 3.
    Afrati, F., Li, C., Mitra, P.: Rewriting queries using views in the presence of arithmetic comparisons. Technical report, UC Irvine (2002)Google Scholar
  4. 4.
    Afrati, F.N., Li, C., Mitra, P.: On containment of conjunctive queries with arithmetic comparisons. In: Bertino, E., Christodoulakis, S., Plexousakis, D., Christophides, V., Koubarakis, M., Böhm, K., Ferrari, E. (eds.) EDBT 2004. LNCS, vol. 2992, pp. 459–476. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  5. 5.
    Afrati, F., Li, C., Ullman, J.D.: Generating efficient plans for queries using views. In: SIGMOD, pp. 319–330 (2001)Google Scholar
  6. 6.
    Chandra, A.K., Merlin, P.M.: Optimal implementation of conjunctive queries in relational data bases. In: STOC, pp. 77–90 (1977)Google Scholar
  7. 7.
    Deutsch, A.: XML Query Reformulation over Mixed and Redundant Storage. PhD thesis, University of Pennsylvania (2002)Google Scholar
  8. 8.
    Duschka, O.M., Genesereth, M.R.: Answering recursive queries using views. In: PODS, pp. 109–116 (1997)Google Scholar
  9. 9.
    Grahne, G., Mendelzon, A.O.: Tableau techniques for querying information sources through global schemas. In: Beeri, C., Bruneman, P. (eds.) ICDT 1999. LNCS, vol. 1540, pp. 332–347. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  10. 10.
    Gupta, A., Sagiv, Y., Ullman, J.D., Widom, J.: Constraint checking with partial information. In: PODS, pp. 45–55 (1994)Google Scholar
  11. 11.
    Halevy, A.Y.: Answering queries using views: A survey. VLDB Journal 10(4), 270–294 (2001)zbMATHCrossRefGoogle Scholar
  12. 12.
    Klug, A.: On conjunctive queries containing inequalities. Journal of the ACM 35(1), 146–160 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    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
  14. 14.
    Levy, A., Mendelzon, A.O., Sagiv, Y., Srivastava, D.: Answering queries using views. In: PODS, pp. 95–104 (1995)Google Scholar
  15. 15.
    Levy, A., Rajaraman, A., Ordille, J.J.: Querying heterogeneous information sources using source descriptions. In: VLDB, pp. 251–262 (1996)Google Scholar
  16. 16.
    Levy, A., Rajaraman, A., Ullman, J.: Answering queries using limited external processors. In: PODS, pp. 227–234 (1996)Google Scholar
  17. 17.
    Levy, A., Sagiv, Y.: Queries independent of updates. In: VLDB, pp. 171–181 (1993)Google Scholar
  18. 18.
    Mitra, P.: An algorithm for answering queries efficiently using views. In: Proceedings of the Australasian Database Conference, pp. 99–106 (2001)Google Scholar
  19. 19.
    Popa, L.: Object/Relational Query Optimization with Chase and Backchase. PhD thesis, University of Pennsylvania (2000)Google Scholar
  20. 20.
    Pottinger, R., Halevy, A.: A scalable algorithm for answering queries using views. VLDB Journal 10(2-3), 182–198 (2001)zbMATHGoogle Scholar
  21. 21.
    Qian, X.: Query folding. In: ICDE, pp. 48–55 (1996)Google Scholar
  22. 22.
    Sagiv, Y., Yannakakis, M.: Equivalences among relational expressions with the union and difference operators. Journal of the ACM 27(4), 633–655 (1980)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Stockmeyer, L.J.: The polynomial-time hierarchy. Theoretical Computer Science 3, 1–22 (1977)zbMATHCrossRefMathSciNetGoogle Scholar
  24. 24.
    van der Meyden, R.: The complexity of querying indefinite data about linearly ordered domains. In: PODS, pp. 331–345 (1992)Google Scholar
  25. 25.
    Zhang, X., Ozsoyoglu, M.Z.: On efficient reasoning with implication constraints. In: DOOD, pp. 236–252 (1993)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Foto Afrati
    • 1
  • Rada Chirkova
    • 2
  • Manolis Gergatsoulis
    • 3
  • Vassia Pavlaki
    • 1
  1. 1.Department of Electrical and Computing EngineeringNational Technical University of Athens (NTUA)AthensGreece
  2. 2.Computer Science DepartmentNorth Carolina State UniversityRaleigh
  3. 3.Department of Archive and Library SciencesIonian UniversityCorfuGreece

Personalised recommendations