First-Order Incremental Evaluation of Datalog Queries

Extended Abstract
  • Guozhu Dong
  • Jianwen Su
Conference paper
Part of the Workshops in Computing book series (WORKSHOPS COMP.)


We consider the problem of repeatedly evaluating the same (computationally expensive) query to a database that is being updated between successive query requests. In this situation, it should be possible to use the difference between successive database states and the answer to the query in one state to reduce the cost of evaluating the query in the next state. We use first-order (i.e., nonrecursive) queries to compute the differences, and call this process first-order incremental query evaluation.

After formalizing the notion of a first-order incremental query evaluation system (FOIES), we present an earlier result that every regular chain query (which are associated with chain Datalog programs) has a FOIES. We then extend this result to the situations (1) where regular chain queries are augmented with binary conjunctive queries with unions, defining nonrecursive predicates, that have “cartesian-closed increment” (CCI), and (2) where insertions for regular queries are unbounded but “cartesian-closed” sets. The notion of CCI is essential in proving (1). We also studied the decision problem for CCI. It is shown that the CCI property is decidable for binary conjunctive queries with unions but undecidable for recursive queries and for relational calculus queries. We also consider a subclass of FOIES, “space-free” FOIES, which use no additional facts in the incremental evaluation. We show that there are queries which have FOIES but not space-free FOIES and that it is undecidable if a Datalog query has a space-free FOIES. Finally, many questions remain open. For example, does there exist a Datalog query which does not have any FOIES?


Logic Program Incremental Evaluation Conjunctive Query Deductive Database Datalog Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    F. Afrati and S.S. Cosmadakis. Expressiveness of restricted recursive queries. In Proc. ACM SIGACT Symp. on the Theory of Computing, 113–126, 1989.Google Scholar
  2. [2]
    K.R.Apt, H.A.Blair, and A.Walker. Towards a theory of declarative knowledge. In J.Minker, editor, Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann, 1988.Google Scholar
  3. [3]
    S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Manuscript. 1992.Google Scholar
  4. [4]
    K. R. Apt and J.-M. Pugin. Maintenance of stratified databases viewed as a belief revision system. In Proc. 6th ACM Symp. on PODS, pages 136–145, 1987.Google Scholar
  5. [5]
    A. Aho and J. Ullman. Universality of data retrieval languages. In Proc. ACM Symp. on Principles of Programming Languages, pages 110–120, 1979.Google Scholar
  6. [6]
    F. Bancilhon. Naive evaluation of recursively defined relations. In M. L. Brodie and J. Mylopoulos, editors, On Knowledge Base Management Systems: Integrating Artificial Intelligence and Database Technologies. Springer-Verlag, 1985.Google Scholar
  7. [7]
    V. Breazu-Tannen, P. Buneman, and L. Wong. Naturally embedded query languages. In Proc. 1992 Int’l Conference on Database Theory, pages 140154, Berlin, Germany, October 1992.Google Scholar
  8. [8]
    F. Bancilhon, D. Maier, Y. Sagiv, and J. D. Ullman. Magic sets and other strange ways to implement logic programs. In Proc. 5th ACM Symp. on PODS, 1–15, 1986.Google Scholar
  9. [9]
    F. Bry, H. Decker and R. Manthey. A uniform approach to constraint satisfaction and constraint satisfiability in deductive databases. In Proc. 1st Int. Conf. on EDBT, 1988.Google Scholar
  10. [10]
    A.L. Buchsbaum, P.C. Kanellakis and J.S. Vitter. A data structure for arc insertion and regular path finding. In Proc. ACM-SIAM Symp. on Discrete Algorithms, 1990.Google Scholar
  11. [11]
    A. Chandra and P. Merlin. Optimal implementation of conjunctive queries in relational data bases. In Proc. ACM SIGACT Symp. on the Theory of Computing, pages 77–90, 1977.Google Scholar
  12. [12]
    G. Dong. On Datalog linearization of chain queries. In J.D. Ullman, editor, Theoretical Studies in Computer Science, pages 181–206. Academic Press, 1991Google Scholar
  13. [13]
    G. Dong. Datalog expressiveness of chain queries: Grammar tools and characterizations. In Proc. Eleventh ACM Symp. on Principles of Database Systems, pages 81–90, 1992.CrossRefGoogle Scholar
  14. [14]
    G. Dong and J. Su. First-order on-line computation of transitive closure queries. In Proc. of 16th Australian Computer Science Conference, pages 721–729, 1993.Google Scholar
  15. [15]
    G. Dong and R. Topor. Incremental evaluation of Datalog queries. In Proc. Int’l Conference on Database Theory, pages 282–296, Berlin, Germany, October 1992.Google Scholar
  16. [16]
    A. Gupta, D. Katiyar, and I. S. Mumick. Counting solutions to the view maintenance problem. In K. Ramamohanarao, J. Harland, and G. Dong, editors, Proceedings of the JICSLP Workshop on Deductive Databases, Washington DC, November 1992.Google Scholar
  17. [17]
    G. G. Hillerbrand, P. C. Kanellakis, H. G. Mairson, and M. Y. Vardi. Tools for Datalog boundedness. In Proc. 10th ACM Symp. on PODS, pages 1–12, 1991.Google Scholar
  18. [18]
    T. Ibaraki and N. Katoh. On-line computation of transitive closure of graphs. Information Processing Letters, 16: 95–97, 1983.MathSciNetMATHCrossRefGoogle Scholar
  19. [19]
    G.F. Italiano. Amortized efficiency of a path retrieval data structure. Theoretical Computer Science, 48: 273–281, 1986.MathSciNetMATHCrossRefGoogle Scholar
  20. [20]
    Y. Ioannidis. A time bound on the materialization of some recursively defined views. In Proc. of International Conference on Very Large Data Bases, 1985.Google Scholar
  21. [21]
    D. Jacobs and R. Hull. Database programming with delayed updates. In Proc. 3rd Int’l Workshop on Database Programming Languages, pages 416–428, 1991.Google Scholar
  22. [22]
    H. Jakobsson. On materializing views and on-line queries. In Proc. Int’l Conference on Database Theory, pages 407–420, Berlin, Germany, October 1992.Google Scholar
  23. [23]
    V. Küchenhoff. On the efficient computation of the difference between consecutive database states. In C. Delobel, M. Kifer, and Y. Masunaga, editors, Proc. 2nd Int. Conf. on DOOD, Lecture Notes in Computer Science 566, 478–502. Springer-Verlag, 1991.Google Scholar
  24. [24]
    J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. Journal of Logic Programming, 11: 217–242, 1991.MathSciNetMATHCrossRefGoogle Scholar
  25. [25]
    J. W. Lloyd, E. A. Sonenberg, and R. W. Topor. Integrity constraint checking in stratified databases. Journal of Logic Programming,4(4):331343, 1987.Google Scholar
  26. [26]
    J-M. Nicolas. Logic for improving integrity checking in relational data bases. Acta Informatica, 18 (3): 227–253, 1982.MathSciNetMATHCrossRefGoogle Scholar
  27. [27]
    X. Qian. On the expressive power of the bounded iteration construct. In Proc. 2nd Int’l Workshop on Database Programming Languages, pages 411–421, 1989.Google Scholar
  28. [28]
    M. H. van Emden and R. A. Kowalski. The semantics of predicate logic as a programming language. Journal of the ACM, 23 (4): 733–742, 1976.MATHCrossRefGoogle Scholar
  29. [29]
    J. D. Ullman. Principles of Database and Knowledge-base Systems, Vols I and II. 1989, Computer Science Press.Google Scholar
  30. [30]
    M. Vardi. Decidability and undecidability results for boundedness of linear recursive programs. In Proc. of the ACM Symposium on Principles of Database Systems, pages 341–351, 1988.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  • Guozhu Dong
    • 1
  • Jianwen Su
    • 2
  1. 1.Department of Computer ScienceThe University of MelbourneParkvilleAustralia
  2. 2.Department of Computer ScienceUniversity of CaliforniaSanta BarbaraUSA

Personalised recommendations