Containment of Conjunctive Queries over Databases with Null Values

  • Carles Farré
  • Werner Nutt
  • Ernest Teniente
  • Toni Urpí
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4353)

Abstract

We study containment of conjunctive queries that are evaluated over databases that may contain tuples with null values. We assume the semantics of SQL for single block queries with a SELECT DISTINCT clause. This problem (“null containment” for short) is different from containment over databases without null values and sometimes more difficult.

We show that null-containment for boolean conjunctive queries is NP-complete while it is \(\mathit\Pi^{\rm P}_{2}\)-complete for queries with distinguished variables. However, if no relation symbol is allowed to appear more than twice, then null-containment is polynomial, as it is for databases without nulls. If we add a unary test predicate IS NULL, as it is available in SQL, then containment becomes \(\mathit\Pi^{\rm P}_{2}\)-hard for boolean queries, while it remains in \(\mathit\Pi^{\rm P}_{2}\) for arbitrary queries.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Calvanese, D., Giacomo, G.D., Lenzerini, M., Vardi, M.Y.: Containment of conjunctive regular path queries with inverse. In: Proc. 7th KR, pp. 176–185 (2000)Google Scholar
  2. 2.
    Calvanese, D., Giacomo, G.D., Vardi, M.Y.: Decidable containment of recursive queries. In: Calvanese, D., Lenzerini, M., Motwani, R. (eds.) ICDT 2003. LNCS, vol. 2572, pp. 1–18. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  3. 3.
    Chandra, A., Merlin, P.: Optimal implementation of conjunctive queries in relational databases. In: Proc. 9th STOC (1977)Google Scholar
  4. 4.
    Chaudhuri, S., Vardi, M.: Optimization of real conjunctive queries. In: Proc. 12th PODS (1993)Google Scholar
  5. 5.
    Cohen, S., Nutt, W., Sagiv, Y.: Containment of aggregate queries. In: Calvanese, D., Lenzerini, M., Motwani, R. (eds.) ICDT 2003. LNCS, vol. 2572, Springer, Heidelberg (2002)Google Scholar
  6. 6.
    Fernandez, M., Florescu, D., Levy, A., Suciu, D.: Verifying integrity constraints on web-sites. In: Proc. 16th IJCAI, pp. 614–619 (1999)Google Scholar
  7. 7.
    Garcia-Molina, H., Ullman, J., Widom, J.: Database Systems: The Complete Book. Pearson Education International, London (2002)Google Scholar
  8. 8.
    Klug, A.: On conjunctive queries containing inequalities. J. ACM 35(1), 146–160 (1988)MATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Kolaitis, P., Martin, D., Thakur, M.: On the complexity of the containment problem for conjunctive queries with built-in predicates. In: Proc. 17th PODS, pp. 197–204 (1998)Google Scholar
  10. 10.
    Levy, A., Mendelzon, A., Sagiv, Y., Srivastava, D.: Answering queries using views. In: Proc. 14th PODS, pp. 95–104 (1995)Google Scholar
  11. 11.
    Levy, A., Sagiv, Y.: Queries independent of updates. In: Proc. 19th VLDB, pp. 171–181 (1993)Google Scholar
  12. 12.
    Miklau, G., Suciu, D.: Containment and equivalence for an XPath fragment. In: Proc. 21st PODS, pp. 65–76 (2002)Google Scholar
  13. 13.
    Popa, L., Tannen, V.: An equational chase for path-conjunctive queries, constraints, and views. In: Beeri, C., Bruneman, P. (eds.) ICDT 1999. LNCS, vol. 1540, pp. 39–57. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  14. 14.
    Sagiv, Y., Saraiya, Y.: Minimizing restricted-fanout queries. Discrete Applied Mathematics 40, 245–264 (1992)MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Sagiv, Y., Yannakakis, M.: Equivalence among relational expressions with the union and difference operators. J. ACM 27(4), 633–655 (1981)CrossRefMathSciNetGoogle Scholar
  16. 16.
    Shmueli, O.: Equivalence of datalog programs is undecidable. Theoretical Computer Science 15(3), 231–242 (1993)MATHMathSciNetGoogle Scholar
  17. 17.
    Ullman, J.: 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
  18. 18.
    van der Meyden, R.: The complexity of querying indefinite data about linearly ordered domains. J. Computer and System Sciences 54(1), 113–135 (1997)MATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Carles Farré
    • 1
  • Werner Nutt
    • 2
  • Ernest Teniente
    • 1
  • Toni Urpí
    • 1
  1. 1.Departament de Llenguatges i Sistemes InformaticsUnversitat Politècnica de CatalunyaBarcelonaSpain
  2. 2.Faculty of Computer ScienceFree University of Bozen-BolzanoBozenItaly

Personalised recommendations