Optimizing Inequality Joins in Datalog with Approximated Constraint Propagation

  • Dario Campagna
  • Beata Sarna-Starosta
  • Tom Schrijvers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7149)


Datalog systems evaluate joins over arithmetic (in)equalities as a naive generate-and-test of Cartesian products. We exploit aggregates in a source-to-source transformation to reduce the size of Cartesian products and to improve performance. Our approach approximates the well-known propagation technique from Constraint Programming.

Experimental evaluation shows good run time speed-ups on a range of non-recursive as well as recursive programs. Furthermore, our technique improves upon the previously reported in the literature constraint magic set transformation approach.


Constraint Programming Integrity Constraint Engine Program Recursive Program Predicate Transformation 
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.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison-Wesley (1995)Google Scholar
  2. 2.
    Ashley-Rollman, M.P., De Rosa, M., Srinivasa, S.S., Pillai, P., Goldstein, S.C., Campbell, J.D.: Declarative Programming for Modular Robots. In: Workshop on Self-Reconfigurable Robots/Systems and Applications at IROS (2007)Google Scholar
  3. 3.
    Bravenboer, M., Smaragdakis, Y.: Exception Analysis and Points-To Analysis: Better Together. In: ISSTA, pp. 1–12 (2009)Google Scholar
  4. 4.
    Bravenboer, M., Smaragdakis, Y.: Strictly Declarative Specification of Sophisticated Points-To Analyses. In: OOPSLA, pp. 243–262 (2009)Google Scholar
  5. 5.
    Choi, C., Harvey, W., Lee, J., Stuckey, P.: Finite Domain Bounds Consistency Revisited. In: Sattar, A., Kang, B.-h. (eds.) AI 2006. LNCS (LNAI), vol. 4304, pp. 49–58. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  6. 6.
    Cui, B., Warren, D.S.: A System for Tabled Constraint Logic Programming. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 478–492. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  7. 7.
    Google’s Protocol Buffers,
  8. 8.
    Lam, M.S., Whaley, J., Livshits, V.B., Martin, M.C., Avots, D., Carbin, M., Unkel, C.: Context-sensitive program analysis as database queries. In: PODS, pp. 1–12 (2005)Google Scholar
  9. 9.
    Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM Trans. Comput. Logic 7(3), 499–562 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Li, N., Mitchell, J.C.: DATALOG with Constraints: A Foundation for Trust Management Languages. In: Dahl, V. (ed.) PADL 2003. LNCS, vol. 2562, pp. 58–73. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  11. 11.
  12. 12.
    Loo, B.T., Condie, T., Garofalakis, M.N., Gay, D.E., Hellerstein, J.M., Maniatis, P., Ramakrishnan, R., Roscoe, T., Stoica, I.: Declarative networking: language, execution and optimization. In: SIGMOD, pp. 97–108 (2006)Google Scholar
  13. 13.
    Maier, D., Warren, D.S.: Computing with Logic: Logic Programming with Prolog. Benjamin/Cummings (1988)Google Scholar
  14. 14.
  15. 15.
    Rosenwald, J.: SWI-Prolog Google’s Protocol Buffers library,
  16. 16.
  17. 17.
    Sereni, D., Avgustinov, P., de Moor, O.: Adding magic to an optimising Datalog compiler. In: SIGMOD, pp. 553–565 (2008)Google Scholar
  18. 18.
    Stuckey, P.J., Sudarshan, S.: Compiling query constraints (extended abstract). In: PODS, pp. 56–67 (1994)Google Scholar
  19. 19.
    White, W., Demers, A., Koch, C., Gehrke, J., Rajagopalan, R.: Scaling games to epic proportions. In: SIGMOD, pp. 31–42 (2007)Google Scholar
  20. 20.
    Wielemaker, J.: SWI-Prolog 5.10 Reference Manual (April 2010),
  21. 21.
    Zook, D., Pasalic, E., Sarna-Starosta, B.: Typed Datalog. In: Gill, A., Swift, T. (eds.) PADL 2009. LNCS, vol. 5418, pp. 168–182. Springer, Heidelberg (2008)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Dario Campagna
    • 1
  • Beata Sarna-Starosta
    • 2
  • Tom Schrijvers
    • 3
  1. 1.Dept.of Mathematics and Computer ScienceUniversity of PerugiaItaly
  2. 2.LogicBlox Inc.AtlantaUSA
  3. 3.Dept. of Applied Mathematics and Computer ScienceUGentBelgium

Personalised recommendations