Skip to main content

Magic checking: Constraint checking for database query optimisation

  • Conference paper
  • First Online:
Constraint Databases and Application (CDB 1995)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1034))

Included in the following conference series:

Abstract

Constraint satisfaction techniques, embedded in constraint programming languages such as CHIP, have proven their worth on a wide variety of practical applications. This paper describes a first step towards integrating these techniques into database systems. The main idea is to optimise complex queries by continually checking to see if the current partial results are consistent with the remainder of the query.

In this paper we present a query language, based on Datalog, which enables the database user to control the checking by annotating certain atomic goals. We show how queries expressed in this language can be translated into queries expressed in standard Datalog. Each Datalog rule is separately optimised by the database optimiser.

The language and the translation are motivated by various examples; in particular an application to crossword generation is described where the optimisation proposed in this paper adds significantly to standard database optimisation techniques.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. P. Bernstein and D. Chiu. Using semi-joins to solve relational queries. ACM, 28(1):25–40, January 1983.

    Google Scholar 

  2. P. Brisset, T. Frühwirth, P. Lim, M. Meier, T. Le Provost, J. Schimpf, and M.G. Wallace. ECLiPSe 3.5 extension user manual. CHIC Deliverable D.6.2.4, ECRC, Arabellastr 17, Munich, Germany, 1995.

    Google Scholar 

  3. C. Beeri, R. Fagin, D. Maier, and M. Yannakakis. On the desirability of acyclic database schemes. ACM, 30(3):479–513, July 1983.

    Article  Google Scholar 

  4. S. Bressan, T. Le Provost, and M.G. Wallace. Towards the application of generalised propagation to database query processing. CHIC Deliverable D.5.2.3.5, ECRC, Arabellastr 17, Munich, Germany, 1994.

    Google Scholar 

  5. F. Bancilhon, D. Maier, Y. Sagiv, and J. Ullman. Magic sets and other strange ways to implement logic programs. In Proc. 5th ACM Symposium on Principles of Database Systems, 1986.

    Google Scholar 

  6. F. Bancilhon and R. Ramakrishnan. An amateur's introduction to recursive query processing. In Proc. SIGMOD, 1986. invited paper.

    Google Scholar 

  7. C. Beeri and R. Ramakrishnan. On the power of magic. In Proc. 6th PODS, 1987.

    Google Scholar 

  8. S. Bressan. Database query optimisation and evaluation as constraint satisfaction problem solving. In P. Revesz, D. Srivastava, P. Stuckey, and D. Sudarshan, editors, Proc. Post-ILPS Workshop on Constraints and Databases, Ithaca, NY., November 1994. Published as Technical Report UNL-CSE-94-025, Univ. of Nebraska.

    Google Scholar 

  9. C. Beeri, R. Ramakrishnan, D. Srivastava, and S Sudarshan. Magic implementation of stratified logic programs. Technical Report, August 1990.

    Google Scholar 

  10. U. S. Chakravarthy, J. Grant, and J. Minker. Foundations of semantic query optimization for deductive databases. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 243–273. Morgan Kaufmann, 1988.

    Google Scholar 

  11. Rina Dechter. Constraint networks. In Stuart C. Shapiro, editor, Encyclopedia of Artificial Intelligence, pages 276–285. Wiley, 1992. Volume 1, second edition.

    Google Scholar 

  12. M. Dincbas, P. van Hentenryck, H. Simonis, A. Aggoun, T. Graf, and F. Berthier. The Constraint Logic Programming Language CHIP. In Proceedings of the International Conference on Fifth Generation Computer Systems FGCS-88, pages 693–702, Tokyo, Japan, December 1988.

    Google Scholar 

  13. ECRC. ECLiPSe knowledge base user manual. Technical report, ECRC, Arabellastr 17, 81925 Munich, 1993.

    Google Scholar 

  14. S.W. Golomb and L.D. Baumert. Backtrack programming. Journal of the ACM, 12:516–524, 1965.

    Google Scholar 

  15. M. Hammer and S. Zdonik. Knowledge-based query processing. In Proc. 6th VLDB Conference, Montreal, 1980.

    Google Scholar 

  16. ICL, Lloyd's Register, Imperial College, and UMIST. CHRONOS DTI/EPSRC project no. 8028. UK government funded Scientific Research Project, 1994.

    Google Scholar 

  17. ILOG. ILOG solver users manual. Technical report, ILOG, 1995.

    Google Scholar 

  18. J.J. King. Quist: A system for semantic query optimisation in relational databases. In Proc. 7th VLDB Conference, 1981.

    Google Scholar 

  19. Vipin Kumar. Algorithms for constraint-satisfaction problems: A survey. A.I. Magazine, 13(1):32–44, Spring 1992.

    Google Scholar 

  20. A.K. Mackworth. Consistency in networks of relations. Artificial Intelligence, 8(1):99–118, 1977.

    Article  Google Scholar 

  21. Meier M. and et. al. ECLiPSe 3.5. Technical Report ECRC/ECLIPSE, ECRC, Arabellastr 17, 81725 Munich, 1995.

    Google Scholar 

  22. R. Mohr and T.C. Henderson. Arc and path consistency revisited. Artificial Intelligence, 28:225–233, 1986.

    Google Scholar 

  23. U. Montanari. Networks of constraints: fundamental properties and applications to picture processing. Information Science, 7(2):95–132, 1974.

    Google Scholar 

  24. T. Le Provost and M.G. Wallace. Generalised constraint propagation over, the CLP scheme. Journal of Logic Programming, 16(3):319–360, July 1993.

    Google Scholar 

  25. R. Ramakrishnan. Magic templates: A spellbinding approach to logic programs. In Proc. International Conference on Logic Programming, Seattle, Washington, 1988.

    Google Scholar 

  26. J. Rohmer, R. Lescoeur, and J.-M. Kerisit. The alexander method: A technique for the processing of recursive axioms in deductive databases. New Generation Computing, 4(3), 1986.

    Google Scholar 

  27. D. Sacca and C. Zaniolo. The generalised counting method for recursive logical queries. In Proc. 1st International Conference on Database Theory, 1986.

    Google Scholar 

  28. J. D. Ullman. Principles of Database Systems. Pitman, second edition, 1982.

    Google Scholar 

  29. Pascal Van Hentenryck. Constraint Satisfaction in Logic Programming. Logic Programming Series. MIT Press, Cambridge, MA, 1989.

    Google Scholar 

  30. L. Vieille. Recursive query processing: The power of logic. Theoretical Computer Science, 69(1), December 1989.

    Google Scholar 

  31. M.G. Wallace, editor. Proc. Conf. on Practical Applications of Constraints Technology, Paris, 1995.

    Google Scholar 

  32. D.H.D. Warren. Efficient processing of interactive relational database queries expressed in logic. In Proc. 7th VLDB, Cannes, 1981.

    Google Scholar 

  33. M.G. Wallace and T. Le Provost. Propia — final implementation. CHIC Deliverable D.5.2.3.6, ECRC, Arabellastr 17, Munich, Germany, 1995.

    Google Scholar 

  34. E. Wong and K. Youseffi. Decomposition — a strategy for query processing. ACM Transactions on Database Systems, 1(3):223–241, 1976.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Gabriel Kuper Mark Wallace

Rights and permissions

Reprints and permissions

Copyright information

© 1996 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Wallace, M., Bressan, S., Le Provost, T. (1996). Magic checking: Constraint checking for database query optimisation. In: Kuper, G., Wallace, M. (eds) Constraint Databases and Application. CDB 1995. Lecture Notes in Computer Science, vol 1034. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60794-3_19

Download citation

  • DOI: https://doi.org/10.1007/3-540-60794-3_19

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60794-6

  • Online ISBN: 978-3-540-49456-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics