Skip to main content
Log in

A semantic approach to optimize linear datalog programs

  • Original article
  • Published:
Acta Informatica Aims and scope Submit manuscript

Abstract

In this work, we present a semantic query optimization approach to improve the efficiency of the evaluation of a subset of SQL:1999 recursive queries. Using datalog notation, we can state our main contribution as an algorithm that builds a program P′ equivalent to a given program P, when both are applied over a database d satisfying a set of functional dependencies. The input program P is a linear recursive datalog program. The new program P′ has less different variables and, sometimes, less atoms in rules, thus it is cheaper to evaluate. Using coral and ibm db2, P′ is empirically shown to be more efficient than the original program.

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. Db2 query patroller: Query processing. URL: http://www- 06.ibm.com/software/data/db2/querypatroller/queryprocessing.html.

  2. Abiteboul S. (1989): Boundedness is undecidable for datalog programs with a single recursive rule. Inf. Process. Lett. 32(6): 282–287

    Google Scholar 

  3. Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison Wesley, Reading (1995)

  4. Aho A.V., Beeri C., Ullman J.D. (1979): The theory of joins in relational databases. ACM Trans. Database Syst. 4(3):297–314

    Article  Google Scholar 

  5. Armstong, W.W.: Dependency structures of data base relationships. In Proc. 1974 IFIP Congress, pp. 580–583 (1974)

  6. Bancilhon, F., Maier, D., Sagiv, Y., Ullman, J.D.: Magic sets and other strange ways to implement logic programs. In Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, pp. 1–16, Cambridge, Massachusetts, 24–26 March (1986)

  7. Bancilhon, F., Ramakrishnan, R.: An amateur’s introduction to recursive query processing strategies. In Proceedings of ACM SIGMOD International Conference on Management of Data, Washington, DC, pp. 16–52. ACM, New York (1986)

  8. Beeri C., Vardi M.Y. (1984): A proof procedure for data dependencies. J. ACM, 31, 718–741

    Article  MATH  MathSciNet  Google Scholar 

  9. Brisaboa, N.R.: Gonzalez-Tuchmann, A. Hernández, H. J. and José R. Paramá. The chase of datalog programs. In Advances in Databases: proceedings of 16th British National Conference on Databases, BNCOD16, of Lecture Notes in Computer Science, vol. 1405 pp. 165–166. Springer, Berlin Heidelberg New York (1998)

  10. Brisaboa, N.R., Gonzalez-Tuchmann, A., Hernández, H.J., Paramá, J.R.: Chasing programs in datalog. In Proceedings of the 6th International Workshop on Deductive Databases and Logic Programming DDLP98, pp. 13–23. GMD- Forschungzentrum Informationstechnik GmbH 1998 (GMD Report 22) (1998)

  11. Chakravarthy U.S., Grant J., Minker J. (1988): Foundations of semantic query optimization for deductive databases. In: Minker J. (eds) Foundations of Deductive Databases and Logic Programming. Morgan Kauffmann Publishers, San Fransisco, pp. 243–273

    Google Scholar 

  12. Cosmadakis, S.S.: On the first-order expressibility of recursive queries. In: ACM, (ed.), Proceedings of the Eighth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pp. 311–323 (1989)

  13. Cosmadakis, S.S., Kanellakis, P.C.: Parallel evaluation of recursive rule queries. In: Proceedings of Fifth ACM SIGACT-SIGMOD Symposium on Principle of Database Systems, pp. 280–293 (1986)

  14. Deutsch, A., Ludascher, B., Nash, A.: Rewriting queries using views with access patterns under integrity constraints. In Proceedings of ICDT 2005, 10th International Conference on Database Theory, of Lecture Notes in Computer Science, vol. 3363, pp. 352–367. Springer, Berlin Heidelberg New York (2005)

  15. Deutsch, A., Tannen, V.: Reformulation of XML queries and constraints. In Proceedings of ICDT 2003, 9th International Conference on Database Theory, Lecture Notes in Computer Science, vol. 2572 pp. 225–241. Springer, Berlin Heidelberg New York (2003)

  16. Downey P.J., Sethi R., Tarjan R. (1980): Variations on the common subexpression problem. JACM: Journal of the ACM 27(4): 758–771

    MATH  MathSciNet  Google Scholar 

  17. Gaifman, H., Mairson, H.G., Sagiv, Y., Vardi, M.Y.: Undecidable optimization problems for database logic programs. In: Proceedings of 2nd IEEE Symp. on Logic in Computer Science, pp. 106–115 (1987)

  18. Ioannidis Y.E. (1986): A time bound on the materialization of some recursively defined views. Algorithmica 1(3):361–385

    Article  MATH  MathSciNet  Google Scholar 

  19. Lakshmanan, L.V.S., Hernández, H.J.: Structural query optimization – a uniform framework for semantic query optimization in deductive databases. In: Proceedings of Tenth ACM SIGACT-SIGMOD-SIGART Symposium on Principle of Database Systems, pp. 102–114 (1991)

  20. Lerat, N.: Query processing in incomplete logical databases. In: Ausiello, G., Atzeni, P., (ed.) Proceedings of ICDT’86, International Conference on Database Theory, of Lecture Notes in Computer Science, vol. 243 pp. 260–277. Springer, Berlin Heidelberg New York (1986)

  21. Maier D. (1983): The Theory of Relational Databases. Computer Science Press, Mary Land

    MATH  Google Scholar 

  22. Maier D., Mendelzon A.O., Sagiv Y. (1979): Testing implications of data dependencies. ACM Trans. Database Syst. 4(4):455–469

    Article  Google Scholar 

  23. Marcinkowski, J.: The 3 frenchmen method proves undecidability of the uniform boundedness for single recursive rule ternary DATALOG programs. In STACS, pp. 427–438 (1996)

  24. Melton J., Simon A.R. (2002): SQL:1999 Understanding Relational Language Components. Morgan Kaufmann, San Fransisico

    Google Scholar 

  25. Minker J., Nicolas J.M. (1982): On recursive axioms in deductive databases. Inf. Syst. 8(1):1–13

    Article  Google Scholar 

  26. Naughton, J. Data independent recursion in deductive databases. In: Proceedings of Fifth ACM SIGACT-SIGMOD Symposium on Principle of Database Systems, pp. 267–279 (1986)

  27. Naughton, J. Sagiv, Y.: A decidable class of bounded recursions. In: Proc. Sixth ACM SIGACT-SIGMOD Symposium on Principle of Database Systems, pp. 227–236 (1987)

  28. Naughton, J.F., Ramakrishnan, R., Sagiv, Y., Ullman, J.D.: Efficient evaluation of right-, left-, and multi-linear rules. ACM SIGMOD RECORD, 18(2) June (1989) Also published in/as: 19 ACM SIGMOD Conf. on the Management of Data, (Portland OR), May-June (1989)

  29. Papakonstantinou, Y., Vassalos, V.: Query rewriting for semistructured data. In SIGMOD 1999, Proceedings ACM SIGMOD International Conference on Management of Data, pp. 455–466 (1999)

  30. Paramá, J.R., Brisaboa, N.R., Penabad, M.R., Places, A.S.: A semantic query optimization approach to optimize linear datalog programs. In Proceedings of the Sixth East-European Conference on Advances in Databases and Information Systems, of Lecture Notes in Computer Science. vol. 2435 Springer, Berlin Heidelberg New York (2002)

  31. Paramá, J.R., Brisaboa, N.R., Penabad, M.R., Places, A.S.: Implication of functional dependencies for recursive queries. In: Proceedings of Andrei Ershov Fifth International Conference, PSI 2003,of Lecture Notes in Computer Science. vol. 2890 Springer, Berlin Heidelberg New York (2003)

  32. Popa, L.: Object/relational query optimization with Chase and Backchase. PhD Thesis, University of Pennsylvania, (2000)

  33. Popa, L., Deutsch, A., Sahuguet, A., Tannen, V.: A chase too far? In: Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, Dallas, TX, pp. 273–284. ACM, New York (2000)

  34. Ramakrishnan, R.: Magic templates: A spellbinding approach to logic programs. In: R. A. Kowalski and K. A. Bowen, (ed.), Proceedings of the Fifth International Conference and Symposium on Logic Programming, pp. 140–159, ALP, IEEE, The MIT Press. Seatle (1988)

  35. Ramakrishnan, R., Bothner, P., Srivastava, D., Sudarshan, S.: Coral: A databases programming language. Tech. Rep. TR-CS-90-14, Kansas State University, Department of Computing and Information Sciences, (1990)

  36. Ross K.A. (1996): Tail recursion elimination in deductive databases. ACM Trans. Database Syst. 21(2):208–237

    Article  Google Scholar 

  37. Sagiv, Y.: Optimizing datalog programs. In: Jack Minker, (ed.), Foundations of Deductive Databases and Logic Programming, chap. 17, pp. 659–698. Morgan Kauffmann Publishers, San Fransisco (1987)

  38. Ullman J.D. (1988): Principles of Database And Knowledge-Base Systems, vol. 1. Computer Science Press, Mary Land

    Google Scholar 

  39. Ullman J.D. (1989): Principles of Database And Knowledge-Base Systems, vol. 2. Computer Science Press, Mary Land

    Google Scholar 

  40. Vardi, M.Y.: Decidability and undecidability results for boundedness of linear recursive queries. In: Proceedings of Seventh ACM SIGACT-SIGMOD Symposium on Principle of Database Systems, pp. 341–351 (1988)

  41. Wang K., Yuan L.Y. (1992): Preservation of integrity constraints in definite datalog programs. Inf. Process. Lett. 44(4): 185–193

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to José R. Paramá.

Additional information

This work is partially supported by Xunta de Galicia grant PGIDIT05SIN10502PR and Ministerio de Educación y Ciencia (PGE y FEDER) grants TIC2003-06593 and TIN2006-15071-C03-03.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Paramá, J.R., Brisaboa, N.R., Penabad, M.R. et al. A semantic approach to optimize linear datalog programs. Acta Informatica 43, 341–370 (2006). https://doi.org/10.1007/s00236-006-0025-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00236-006-0025-9

Keywords

Navigation