Skip to main content

Non-termination Analysis and Cost-Based Query Optimization of Logic Programs

  • Conference paper
Web Reasoning and Rule Systems (RR 2012)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 7497))

Included in the following conference series:

Abstract

There have been many studies in termination analysis of logic programming but little has been done on analyzing non-termination of logic programs, which is even more important in our opinion. Non-termination analysis examines program execution history when non-termination is suspected and informs the programmer of non-termination causes and possible ways to fix them. In the first part of this thesis, we study the problem of non-termination in tabled logic engines with subgoal abstraction, such as XSB, and propose a suite of algorithms, called non-Termination analyzer, \(\texttt{Terminyzer}\), for automatic detection and explanation of non-termination.

The second part of this thesis focuses on cost-based query optimization. Database query optimizers rely on data statistics in selecting query execution plans and rule-based systems can greatly benefit from such optimizations as well. To this end, one first needs to collect data statistics for base and propagate them to derived predicates. However, there are two difficulties: dependencies among arguments and recursion. To address these problems, we implement a Cost-based query optimizer, \(\texttt{Costimizer}\), which consists of a cost estimator and an optimizing unit. The optimizing unit performs a greedy search optimization based on predicate statistics computed by the cost estimator. We validate the effectiveness of \(\texttt{Costimizer}\) on both size estimation and query optimization through experimental studies.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Bruynooghe, M., Codish, M., Gallagher, J.P., Genaim, S., Vanhoof, W.: Ter- mination analysis of logic programs through combination of type-based norms. ACM Trans. Program. Lang. Syst. 29 (April 2007), http://doi.acm.org/10.1145/1216374.1216378

  2. Chen, W., Kifer, M., Warren, D.S.: HiLog: A foundation for higher-order logic programming. J. Log. Program. 15(3), 187–230 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  3. Christodoulakis, S.: Implications of certain assumptions in database performance evauation. ACM Trans. Database Syst. 9(2), 163–186 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  4. DeHaan, D., Tompa, F.W.: Optimal top-down join enumeration. In: Proceedings of the 2007 ACM SIGMOD International Conference on Management of Data, SIGMOD 2007, pp. 785–796. ACM, New York (2007)

    Chapter  Google Scholar 

  5. Ioannidis, Y.: The history of histograms (abridged). In: Proc. of VLDB Conference (2003)

    Google Scholar 

  6. Ioannidis, Y.E., Christodoulakis, S.: On the propagation of errors in the size of join results. SIGMOD Rec. 20(2), 268–277 (1991)

    Article  Google Scholar 

  7. Ioannidis, Y.E., Poosala, V.: Balancing histogram optimality and practicality for query result size estimation. In: SIGMOD 1995: Proceedings of the 1995 ACM SIG- MOD International Conference on Management of Data, pp. 233–244. ACM, New York (1995)

    Chapter  Google Scholar 

  8. Liang, S., Kifer, M.: Deriving predicate statistics in datalog. In: Kutsia, T., Schreiner, W., Fernández, M. (eds.) PPDP, pp. 45–56. ACM (2010)

    Google Scholar 

  9. Liang, S., Kifer, M.: Deriving Predicate Statistics for Logic Rules. In: Krötzsch, M., Staraccia, U. (eds.) RR 2012. LNCS, vol. 7497, pp. 139–155. Springer, Heidelberg (2012)

    Google Scholar 

  10. Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: Proving termination for logic pro- grams by the query-mapping pairs approach. In: Program Developments in Computational Logic. LNCS, pp. 453–498. Springer (2004)

    Google Scholar 

  11. Moerkotte, G., Neumann, T.: Dynamic programming strikes back. In: SIGMOD 2008: Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data, pp. 539–552. ACM, New York (2008)

    Chapter  Google Scholar 

  12. Neumerkel, U., Mesnard, F.: Localizing and Explaining Reasons for Non-Terminating Logic Programs with Failure-Slices. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 328–342. Springer, Heidelberg (1999), http://dl.acm.org/citation.cfm?id=645815.668882

    Chapter  Google Scholar 

  13. Nguyen, M.T., De Schreye, D.: Polytool: Proving Termination Automatically Based on Polynomial Interpretations. In: Puebla, G. (ed.) LOPSTR 2006. LNCS, vol. 4407, pp. 210–218. Springer, Heidelberg (2007), http://dl.acm.org/citation.cfm?id=1759187.1759208

    Chapter  Google Scholar 

  14. Nguyen, M.T., Giesl, J., Schneider-Kamp, P., De Schreye, D.: Termination Analysis of Logic Programs Based on Dependency Graphs. In: King, A. (ed.) LOPSTR 2007. LNCS, vol. 4915, pp. 8–22. Springer, Heidelberg (2008), http://dx.doi.org/10.1007/978-3-540-78769-3_2

    Chapter  Google Scholar 

  15. Ono, K., Lohman, G.M.: Measuring the complexity of join enumeration in query optimization. In: Proceedings of the Sixteenth International Conference on Very Large Databases, pp. 314–325. Morgan Kaufmann Publishers Inc., San Francisco (1990), http://portal.acm.org/citation.cfm?id=94362.94436

    Google Scholar 

  16. Payet, E., Mesnard, F.: Nontermination inference of logic programs. ACM Trans. Program. Lang. Syst. 28, 256–289 (2006), http://doi.acm.org/10.1145/1119479.1119481

    Article  Google Scholar 

  17. Riguzzi, F., Swift, T.: Well-definedness and efficient inference for probabilistic logic programming under the distribution semantics. In: TPLP (to appear, 2012)

    Google Scholar 

  18. Schneider-Kamp, P., Giesl, J., Ströder, T., Serebrenik, A., Thiemann, R.: Automated termination analysis for logic programs with cut*. Theory Pract. Log. Program. 10, 365–381, http://dx.doi.org/10.1017/S1471068410000165

  19. Schreye, D.D., Decorte, S.: Termination of logic programs: The never-ending story. J. Log. Program. 19/20, 199–260 (1994)

    Article  Google Scholar 

  20. Selinger, P.G., Astrahan, M.M., Chamberlin, D.D., Lorie, R.A., Price, T.G.: Access path selection in a relational database management system. In: SIGMOD 1979: Proceedings of the 1979 ACM SIGMOD International Conference on Management of Data, pp. 23–34. ACM, New York (1979)

    Chapter  Google Scholar 

  21. Sipser, M.: Introduction to the Theory of Computation, 1st edn. International Thomson Publishing (1996)

    Google Scholar 

  22. Stillger, M., Lohman, G.M., Markl, V., Kandil, M.: Leo - db2’s learning optimizer. In: VLDB 2001: Proceedings of the 27th International Conference on Very Large Data Bases, pp. 19–28. Morgan Kaufmann Publishers Inc., San Francisco (2001)

    Google Scholar 

  23. Swift, T., Warren, D.S., Sagonas, K., Freire, J., Rao, P., Cui, B., Johnson, E., de Castro, L., Marques, R.F., Saha, D., Dawson, S., Kifer, M.: The XSB system, version 3.3.x., vol. 1. Programmer’s manual, http://xsb.sourceforge.net

  24. Swift, T., Warren, D.S.: Xsb: Extending prolog with tabled logic programming. CoRR abs/1012.5123 (2010)

    Google Scholar 

  25. Vance, B., Maier, D.: Rapid bushy join-order optimization with cartesian products. In: Proceedings of the 1996 ACM SIGMOD International Conference on Management of Data, SIGMOD 1996, pp. 35–46. ACM, New York (1996)

    Chapter  Google Scholar 

  26. Voets, D., De Schreye, D.: Non-termination Analysis of Logic Programs Using Types. In: Alpuente, M. (ed.) LOPSTR 2010. LNCS, vol. 6564, pp. 133–148. Springer, Heidelberg (2011), http://dl.acm.org/citation.cfm?id=2008282.2008291

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Liang, S. (2012). Non-termination Analysis and Cost-Based Query Optimization of Logic Programs. In: Krötzsch, M., Straccia, U. (eds) Web Reasoning and Rule Systems. RR 2012. Lecture Notes in Computer Science, vol 7497. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33203-6_33

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-33203-6_33

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-33202-9

  • Online ISBN: 978-3-642-33203-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics