Skip to main content
Log in

Equivalence of queries that are sensitive to multiplicities

  • Regular Paper
  • Published:
The VLDB Journal Aims and scope Submit manuscript

Abstract

The query equivalence problem has been studied extensively for set-semantics and, more recently, for bag and bag-set semantics. However, SQL queries often combine set, bag and bag-set semantics. For example, an SQL query that returns a multiset of elements may call a subquery or view that returns a set of elements. Queries may access both relations that do not contain duplicates, as well as relations with duplicates. As another example, in SQL one can compute a multiset-union of queries, each of which returns a set of answers. This paper presents combined semantics, which formally models query evaluation combining set, bag and bag-set semantics. The equivalence problem for queries evaluated under combined semantics is studied. A sufficient condition for equivalence is presented. For several important common classes of queries necessary and sufficient conditions for equivalence are presented.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho A.V., Sagiv Y., Ullman J.D.: Efficient optimization of a class of relational expressions. ACM Trans. Database Syst. 4(4), 435–454 (1979)

    Article  Google Scholar 

  2. Calvanese, D., Giacomo, G.D., Vardi, M.Y.: Decidable containment of recursive queries. In: Calvanese, D., et al. (eds.) In: Proceedings of the 9th International Conference on Database Theory, Siena, Italy, January 8–10, 2003, pp. 327–342

  3. Chandra, A.K., Merlin, P.M.: Optimal implementation of conjunctive queries in relational data bases. In: STOC, pp. 77–90. ACM Press, New York (1977)

  4. Chaudhuri, S.: An overview of query optimization in relational systems. In: PODS, pp. 34–43. ACM Press, New York (1998)

  5. Chaudhuri, S., Vardi, M.Y.: Optimization of real conjunctive queries. In: PODS, pp. 59–70. ACM Press, New York (1993)

  6. Chekuri C., Rajaraman A.: Conjunctive query containment revisited. Theor. Comput. Sci. 239(2), 211–229 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  7. Cohen, S.: Equivalence of queries combining set and bag-set semantics. In: Vansummeren, S. (ed.) Proceedings of the Twenty- Fifth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 26–28, 2006, Chicago, Illinois, Maryland, USA, pp. 70–79

  8. Cohen, S., Nutt, W., Serebrenik, A.: Rewriting aggregate queries using views. In: PODS, pp. 155–166. ACM Press, New York (1999)

  9. Cohen, S., Nutt, W., Sagiv, Y.: Containment of Aggregate Queries. In: Calvanese, D., et al. (eds.) Proceedings of the 9th International Conference on Database Theory, Siena, Italy, January 8--10, 2003, pp. 111–125

  10. Cohen S., Sagiv Y., Nutt W.: Equivalences among aggregate queries with negation. ACM Trans. Comput. Log. 6(2), 328–360 (2005)

    Article  MathSciNet  Google Scholar 

  11. Cohen, S., Nutt, W., Sagiv, Y.: Deciding equivalences among conjunctive aggregate queries. J. ACM 54(2), (2007)

  12. Dayal, U.: Of nests and trees: a unified approach to processing queries that contain nested subqueries, aggregates, and quantifiers. In: Stocker, P.M., Kent, W., Hammersley, P. (eds.) VLDB, pp. 197–208. Morgan Kaufmann, San Francisco (1987)

  13. Halevy A.Y.: Answering queries using views: a survey. VLDB J. 10(4), 270–294 (2001)

    Article  MATH  Google Scholar 

  14. Halevy A.Y., Mumick I.S., Sagiv Y., Shmueli O.: Static analysis in datalog extensions. J. ACM 48(5), 971–1012 (2001)

    Article  MathSciNet  Google Scholar 

  15. Ioannidis Y.E., Ramakrishnan R.: Containment of conjunctive queries: beyond relations as sets. ACM Trans. Database Syst. 20(3), 288–324 (1995)

    Article  Google Scholar 

  16. Jayram, T.S., Kolaitis, P.G., Vee, E.: The containment problem for real conjunctive queries with inequalities. In: Vansummeren, S. (ed.) Proceedings of the Twenty-Fifth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 26–28, 2006, Chicago, Illinois, Maryland, USA, pp. 80–89

  17. Johnson D.S., Klug A.C.: Optimizing conjunctive queries that contain untyped variables. SIAM J. Comput. 12(4), 616–640 (1983)

    Article  MATH  MathSciNet  Google Scholar 

  18. Khizder V.L., Toman D., Weddell G.E.: Reasoning about duplicate elimination with description logic. In: Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Palamidessi, C., Pereira, L.M., Sagiv, Y., Stuckey, P.J. (eds.) Computational Logic. Lecture Notes in Computer Science, vol. 1861, pp. 1017–1032. Springer, Berlin (2000)

    Google Scholar 

  19. Kim W.: On optimizing an SQL-like nested query. ACM Trans. Database Syst. 7(3), 443–469 (1982)

    Article  MATH  Google Scholar 

  20. Klug A.C.: On conjunctive queries containing inequalities. J. ACM 35(1), 146–160 (1988)

    Article  MATH  MathSciNet  Google Scholar 

  21. Levy, A.C., Sagiv, Y.: Semantic query optimization in datalog programs. In: PODS, pp. 163–173. ACM Press, New York (1995)

  22. Muralikrishna M.: Improved unnesting algorithms for join aggregate sql queries. In: Yuan, L.-Y. (ed) VLDB, pp. 91–102. Morgan Kaufmann, San Francisco (1992)

    Google Scholar 

  23. Paulley, G.N., Larson, P.-Å.: Exploiting uniqueness in query optimization. In: ICDE, pp. 68–79. IEEE Computer Society, USA (1994)

  24. Pottinger R., Halevy A.Y.: Minicon: a scalable algorithm for answering queries using views. VLDB J. 10(2–3), 182–198 (2001)

    MATH  Google Scholar 

  25. Sagiv Y., Saraiya Y.P.: Minimizing restricted-fanout queries. Discrete Appl. Math. 40(2), 245–264 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  26. Sagiv Y., Yannakakis M.: Equivalences among relational expressions with the union and difference operators. J. ACM 27(4), 633–655 (1980)

    Article  MATH  MathSciNet  Google Scholar 

  27. Ullman J.D.: Principles of Database and Knowledge-Base Systems, vol. I. Computer Science Press, New York (1988)

    Google Scholar 

  28. Ullman J.D.: Principles of Database and Knowledge-Base Systems, vol. II. Computer Science Press, New York (1989)

    Google Scholar 

  29. van der Meyden R.: The complexity of querying indefinite data about linearly ordered domains. J. Comput. Syst. Sci. 54(1), 113–135 (1997)

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sara Cohen.

Additional information

An early version of this article appeared in [7]. This paper extends [7] to include bag semantics, in addition to set and bag-set semantics. This work was partially supported by the Israel Science Foundation (Grant 1032/05).

Rights and permissions

Reprints and permissions

About this article

Cite this article

Cohen, S. Equivalence of queries that are sensitive to multiplicities. The VLDB Journal 18, 765–785 (2009). https://doi.org/10.1007/s00778-008-0122-1

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00778-008-0122-1

Keywords

Navigation