Advertisement

Acta Informatica

, Volume 43, Issue 5, pp 341–370 | Cite as

A semantic approach to optimize linear datalog programs

  • José R. ParamáEmail author
  • Nieves R. Brisaboa
  • Miguel R. Penabad
  • Ángeles S. Places
Original article

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.

Keywords

Deductive databases Semantic query optimization SQL:1999 Recursion 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Db2 query patroller: Query processing. URL: http://www- 06.ibm.com/software/data/db2/querypatroller/queryprocessing.html.Google Scholar
  2. 2.
    Abiteboul S. (1989): Boundedness is undecidable for datalog programs with a single recursive rule. Inf. Process. Lett. 32(6): 282–287Google Scholar
  3. 3.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison Wesley, Reading (1995)Google Scholar
  4. 4.
    Aho A.V., Beeri C., Ullman J.D. (1979): The theory of joins in relational databases. ACM Trans. Database Syst. 4(3):297–314CrossRefGoogle Scholar
  5. 5.
    Armstong, W.W.: Dependency structures of data base relationships. In Proc. 1974 IFIP Congress, pp. 580–583 (1974)Google Scholar
  6. 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)Google Scholar
  7. 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)Google Scholar
  8. 8.
    Beeri C., Vardi M.Y. (1984): A proof procedure for data dependencies. J. ACM, 31, 718–741zbMATHMathSciNetCrossRefGoogle Scholar
  9. 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)Google Scholar
  10. 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)Google Scholar
  11. 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–273Google Scholar
  12. 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)Google Scholar
  13. 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)Google Scholar
  14. 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)Google Scholar
  15. 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)Google Scholar
  16. 16.
    Downey P.J., Sethi R., Tarjan R. (1980): Variations on the common subexpression problem. JACM: Journal of the ACM 27(4): 758–771zbMATHMathSciNetGoogle Scholar
  17. 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)Google Scholar
  18. 18.
    Ioannidis Y.E. (1986): A time bound on the materialization of some recursively defined views. Algorithmica 1(3):361–385zbMATHMathSciNetCrossRefGoogle Scholar
  19. 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)Google Scholar
  20. 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)Google Scholar
  21. 21.
    Maier D. (1983): The Theory of Relational Databases. Computer Science Press, Mary LandzbMATHGoogle Scholar
  22. 22.
    Maier D., Mendelzon A.O., Sagiv Y. (1979): Testing implications of data dependencies. ACM Trans. Database Syst. 4(4):455–469CrossRefGoogle Scholar
  23. 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)Google Scholar
  24. 24.
    Melton J., Simon A.R. (2002): SQL:1999 Understanding Relational Language Components. Morgan Kaufmann, San FransisicoGoogle Scholar
  25. 25.
    Minker J., Nicolas J.M. (1982): On recursive axioms in deductive databases. Inf. Syst. 8(1):1–13CrossRefGoogle Scholar
  26. 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)Google Scholar
  27. 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)Google Scholar
  28. 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)Google Scholar
  29. 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)Google Scholar
  30. 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)Google Scholar
  31. 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)Google Scholar
  32. 32.
    Popa, L.: Object/relational query optimization with Chase and Backchase. PhD Thesis, University of Pennsylvania, (2000)Google Scholar
  33. 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)Google Scholar
  34. 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)Google Scholar
  35. 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)Google Scholar
  36. 36.
    Ross K.A. (1996): Tail recursion elimination in deductive databases. ACM Trans. Database Syst. 21(2):208–237CrossRefGoogle Scholar
  37. 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)Google Scholar
  38. 38.
    Ullman J.D. (1988): Principles of Database And Knowledge-Base Systems, vol. 1. Computer Science Press, Mary LandGoogle Scholar
  39. 39.
    Ullman J.D. (1989): Principles of Database And Knowledge-Base Systems, vol. 2. Computer Science Press, Mary LandGoogle Scholar
  40. 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)Google Scholar
  41. 41.
    Wang K., Yuan L.Y. (1992): Preservation of integrity constraints in definite datalog programs. Inf. Process. Lett. 44(4): 185–193zbMATHMathSciNetCrossRefGoogle Scholar

Copyright information

© Springer-Verlag 2006

Authors and Affiliations

  • José R. Paramá
    • 1
    Email author
  • Nieves R. Brisaboa
    • 1
  • Miguel R. Penabad
    • 1
  • Ángeles S. Places
    • 1
  1. 1.Database Lab. Computer Science DepartmentUniversidade da Coruña, Facultade de InformáticaCoruñaSpain

Personalised recommendations