Space usage in functional query languages

  • Serge Abiteboul
  • Gerd Hillebrand
Contributed Papers Query Languages III
Part of the Lecture Notes in Computer Science book series (LNCS, volume 893)


We consider evaluation strategies for database queries expressed in three functional query languages: the complex value algebra, the simply typed lambda calculus, and method schemas. Each of these query languages derives its expressive power from a different primitive: the complex value algebra from the powerset operator, the simply typed lambda calculus from list iteration, and method schemas from recursion. We show that “natural” evaluation strategies for these primitives may lead to very inefficient space usage, but that with some simple optimizations many queries can be evaluated with little or no space overhead. In particular, we show. (1) In the complex value algebra, all expressions with set nesting depth at most 2 can be evaluated in PSPACE, and this set of expressions is sufficient to express all queries in the polynomial hierarchy; (2) In the simply typed lambda calculus with equality and constants, all query terms of order at most 5 (where “query term” is a syntactic condition on types) can be evaluated in PSPACE, and this set of terms expresses exactly the PSPACE queries; (3) There exists a set of second-order method schemas (with no simple syntactic characterization) that can be evaluated in PSPACE, and this set of schemas is sufficient to express all PSPACE queries.


Query Language Transitive Closure Relational Algebra Query Term Polynomial Space 
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.
    S. Abiteboul and C. Beeri. On the Power of Languages for the Manipulation of Complex Objects. INRIA Research Report 846, 1988.Google Scholar
  2. 2.
    S. Abiteboul, P. Kanellakis, S. Ramaswamy, and E. Waller. Method Schemas. Technical Report CS-92-33, Brown University, 1992. (An earlier version appeared in Proc. 9th ACM PODS, 1990).Google Scholar
  3. 3.
    A. V. Aho and J. D. Ullman. Universality of Data Retrieval Languages. In Proc. 6th ACM POPL, pp. 110–117, 1979.Google Scholar
  4. 4.
    J. Backus. Can Programming be Liberated from the von Neumann Style? A Functional Style of Programming and its Algebra of Programs. CACM 21(8):613–641, 1978.Google Scholar
  5. 5.
    H. Barendregt. The Lambda Calculus: Its Syntax and Semantics. North Holland, 1984.Google Scholar
  6. 6.
    P. Buneman, R. Frankel, and R. Nikhil. An Implementation Technique for Database Query Languages. ACM Trans. Database Syst. 7(2):164–186, 1982.Google Scholar
  7. 7.
    A. K. Chandra and D. Harel. Computable Queries for Relational Data Bases. JCSS, 21(2):156–178, 1980.Google Scholar
  8. 8.
    A. Church. The Calculi of Lambda-Conversion. Princeton University Press, 1941.Google Scholar
  9. 9.
    E. F. Codd. A Relational Model of Data for Large Shared Data Banks. CACM, 13(6):377–387, 1970.Google Scholar
  10. 10.
    B. Courcelle. Recursive Applicative Program Schemes. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. B, pp. 459–492. Elsevier, 1990.Google Scholar
  11. 11.
    M. J. Gordon, R. Milner, L. Morris, M. Newey and C. P. Wadsworth. A Metalanguage for Interactive Proof in LCF. In Proc. 5th ACM POPL, pp. 119–130, 1978.Google Scholar
  12. 12.
    S. Greibach. Theory of Program Structures: Schemes, Semantics, Verification. Springer LNCS 36, 1975.Google Scholar
  13. 13.
    G. Hillebrand. Finite Model Theory in the Simply Typed Lambda Calculus. Ph.D. thesis, Brown University, 1994. Available by anonymous ftp from Scholar
  14. 14.
    G. Hillebrand and P. Kanellakis. Functional Database Query Languages as Typed Lambda Calculi of Fixed Order. In Proc. 13th ACM PODS, pp. 222–231, 1994.Google Scholar
  15. 15.
    G. Hillebrand, P. Kanellakis, and H. Mairson. Database Query Languages Embedded in the Typed Lambda Calculus. In Proc. 8th IEEE LICS, pp. 332–343, 1993.Google Scholar
  16. 16.
    G. Hillebrand, P. Kanellakis, and S. Ramaswamy. Functional Programming Formalisms for OODB Methods. In Proc. of the NATO ASI Summer School on OODEs, Turkey 1993. To appear in Springer LNCS.Google Scholar
  17. 17.
    J. R. Hindley and J. P. Seldin. Introduction to Combinators and λ-Calculus. Cambridge University Press, 1986.Google Scholar
  18. 18.
    P. Hudak and P. Wadler, editors. Report on the Functional Programming Language Haskell. Technical Report YALEU/DCS/RR656, Dept. of Computer Science, Yale University, 1988.Google Scholar
  19. 19.
    R. Hull and J. Su. On the Expressive Power of Database Queries with Intermediate Types. JCSS 43(1):219–267, 1991.Google Scholar
  20. 20.
    P. Kanellakis, J. Mitchell, and H. Mairson. Unification and ML Type Reconstruction. In J.-L. Lassez and G. Plotkin, editors, Computational Logic: Essays in Honor of Alan Robinson, pp. 444–479. MIT Press, 1991.Google Scholar
  21. 21.
    G. Kuper and M. Y. Vardi. On the Complexity of Queries in the Logical Data Model. TCS 116:33–58, 1993.Google Scholar
  22. 22.
    G. M. Kuper and M. Y. Vardi. The Logical Data Model. ACM Trans. Database Syst. 18(3):379–413, 1993.Google Scholar
  23. 23.
    R. Milner. The Standard ML Core Language. Polymorphism, 2(2), 1985. (An earlier version appeared in Proc. of the 1984 ACM Symposium on Lisp and Functional Programming).Google Scholar
  24. 24.
    D. Suciu and J. Paredaens. Any Algorithm in the Complex Object Algebra with Powerset Needs Exponential Space to Compute Transitive Closure. In Proc. 13th ACM PODS, pp. 201–209, 1994.Google Scholar
  25. 25.
    D. A. Turner. Miranda: A Non-Strict Functional Language with Polymorphic Types. In J.-P. Jouannaud, editor, Functional Programming Languages and Computer Architecture, pp. 1–16. Springer LNCS 201, 1985.Google Scholar
  26. 26.
    M. Y. Vardi. The Complexity of Relational Query Languages. In Proc. 14th STOC, pp. 137–146, 1982.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Serge Abiteboul
    • 1
  • Gerd Hillebrand
    • 1
  1. 1.INRIA RocquencourtLe Chesnay cedexFrance

Personalised recommendations