skip to main content
article
Free Access

On conjunctive queries containing inequalities

Published:01 January 1988Publication History
Skip Abstract Section

Abstract

Conjunctive queries are generalized so that inequality comparisons can be made between elements of the query. Algorithms for containment and equivalence of such “inequality queries” are given, under the assumption that the data domains are dense and totally ordered. In general, containment does not imply the existence of homomorphisms (containment mappings), but the homomorphism property does exist for subclasses of inequality queries. A minimization algorithm is defined using the equivalence algorithm. It is first shown that the constants appearing in a query can be divided into “essential” and “nonessential” subgroups. The minimum query can be nondeterministically guessed using only the essential constants of the original query.

References

  1. 1 AHO, A. V., SAGIV, Y., AND ULLMAN, J. D. Efficient optimization of a class of relational expressions. ACM Trans. Database Syst. 4, 4 (Dec. 1979), 435-454. Google ScholarGoogle Scholar
  2. 2 AHO, A. V., SAGIV, Y., AND ULLMAN, J.O. Equivalences among relational expressions. SIAM J. Comput. 8, 2 (May 1979), 218-246.Google ScholarGoogle Scholar
  3. 3 ASTRAHAN, M. M., BLASGEN, M. W., CHAMBERLIN, D. D., ESWARAN, K. P., GRAY, J. N., GRIFFITHS, P. P., KING, W. F., LORIE, R. A., MCJONES, P. R., MEHL, J. W., PUTZOLU, G. R., TRAIGER, I. L., WADE, B. W., AND WATSON, V. System R: Relational approach to database management. ACM Trans. Database Syst. 1, 2 (June 1976), 97-137. Google ScholarGoogle Scholar
  4. 4 BEERI, C., BERNSTEIN, P., AND GOODMAN, N. A sophistieate's introduction to database normalization theory. In Proceedings of the 1978 VLDB Conference (West Berlin). 1978.Google ScholarGoogle Scholar
  5. 5 CHANDRA, A. K., AND MERLIN, P.M. Optimal implementation of conjunctive queries in relational databases. In Proceedings of the 9th Annual ACM Symposium on Theory of Computing. ACM, New York, 1976, pp. 77-90. Google ScholarGoogle Scholar
  6. 6 CODD, E.F. Relational completeness of data base sublanguages. In Data Base Systems, R. Rustin, Ed. Prentice-Hall, Englewood Cliffs, N.J., 1972.Google ScholarGoogle Scholar
  7. 7 DAYAL, U., Gt~DraAN, N., AND KATZ, R. An extended relational algebra with control over duplicate elimination. In Proceedings of the ACM Symposium on Principles of Database Systems. ACM, New York, 1982, pp. 117-123. Google ScholarGoogle Scholar
  8. 8 JOHNSON, D., AND KLUG, A. Optimizing conjunctive queries that contain untyped variables. SIAMJ. Comput. 12, 4 (Nov. 1983), 616-640.Google ScholarGoogle Scholar
  9. 9 JOHNSON, D., AND KLUG, A. Testing containment of conjunctive queries under functional and inclusion dependencies. J. Comput. Syst. Sci. 28, 1 (Feb. 1984), 167-189.Google ScholarGoogle Scholar
  10. 10 SAGIV, Y. Quadratic algorithms for minimizing joins in restricted relational expressions. Tech. Rep. UIUCDCS-R-79-992. Computer Science Dept., Univ. of Illinois, Urbana, I11., 1979.Google ScholarGoogle Scholar
  11. 11 SAGIV, Y., AND YANNAKAKIS, M. Equivalences among relational expressions with the union and difference operators. J. ACM 27, 4 (Oct. 1980), 633-655. Google ScholarGoogle Scholar
  12. 12 SHOVNFIELD, J.R. Mathematical Logic. Addison-Wesley, Reading, Mass., 1967.Google ScholarGoogle Scholar
  13. 13 SOLOMON, M.K. Some properties of relational expressions. In Proceedings of the ACM Southeast Regional Conference. ACM, New York, 1979, pp. 111-116. Google ScholarGoogle Scholar
  14. 14 STON~.nRAK~R, M., WONG, E., KREPS, P., AND HELD, G. The design and implementation of INGRES. ACM Trans. Database Syst. 1, 3 (Sept. 1976), 189-222. Google ScholarGoogle Scholar
  15. 15 ULLMAN, J. D. A view of directions in relational database theory. Rep. STAN-CS-81-852. Computer Science Dept., Stanford Univ., Stanford, Calif., 1981.Google ScholarGoogle Scholar
  16. 16 YANNAKAKIS, M., AND PAPADIMITRIOU, C. Algebraic dependencies. J. Comput. Syst. Sci. 25, 1 (1982), 2--41.Google ScholarGoogle Scholar

Index Terms

  1. On conjunctive queries containing inequalities

      Recommendations

      Reviews

      Kazem Taghva

      Conjunctive queries are a subset of domain calculus expressions built from relational atomic formulas using the logical connective and. In the database setting, the connective and is interpreted as the join operator. Since the join is one of the most expensive operations to perform, the optimization problem for conjunctive queries must deal with minimizing the number of joins. Thus, one must find a query with a minimum number of joins that is equivalent to the original conjunctive query. Chandra and Merlin have shown that the optimization problem for conjunctive queries is NP-complete [1]. In this paper, the author investigates the optimization problem for conjunctive queries containing inequalities. The optimization problem is closely related to the query equivalence and query containment problems. The equivalence problem is to determine whether two queries produce the same output when they are evaluated against the same database. The containment problem is defined similarly. The author has shown that the containment problems for left and right semi-interval queries (in left semi-interval queries, all inequalities are of the form x&thgr; c, where x is a variable, c is a constant, and &thgr; is one of ?<,=) are in NP. The general containment problem is left open. The paper is well written and the proofs are mathematically sound. It is essential reading for people interested in the query optimization problem.

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image Journal of the ACM
        Journal of the ACM  Volume 35, Issue 1
        Jan. 1988
        264 pages
        ISSN:0004-5411
        EISSN:1557-735X
        DOI:10.1145/42267
        Issue’s Table of Contents

        Copyright © 1988 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 January 1988
        Published in jacm Volume 35, Issue 1

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader