Abstract
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.
Preview
Unable to display preview. Download preview PDF.
References
S. Abiteboul and C. Beeri. On the Power of Languages for the Manipulation of Complex Objects. INRIA Research Report 846, 1988.
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).
A. V. Aho and J. D. Ullman. Universality of Data Retrieval Languages. In Proc. 6th ACM POPL, pp. 110–117, 1979.
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.
H. Barendregt. The Lambda Calculus: Its Syntax and Semantics. North Holland, 1984.
P. Buneman, R. Frankel, and R. Nikhil. An Implementation Technique for Database Query Languages. ACM Trans. Database Syst. 7(2):164–186, 1982.
A. K. Chandra and D. Harel. Computable Queries for Relational Data Bases. JCSS, 21(2):156–178, 1980.
A. Church. The Calculi of Lambda-Conversion. Princeton University Press, 1941.
E. F. Codd. A Relational Model of Data for Large Shared Data Banks. CACM, 13(6):377–387, 1970.
B. Courcelle. Recursive Applicative Program Schemes. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. B, pp. 459–492. Elsevier, 1990.
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.
S. Greibach. Theory of Program Structures: Schemes, Semantics, Verification. Springer LNCS 36, 1975.
G. Hillebrand. Finite Model Theory in the Simply Typed Lambda Calculus. Ph.D. thesis, Brown University, 1994. Available by anonymous ftp from ftp.cs.brown.edu:/pub/techreports/94/cs94-24.ps.Z.
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.
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.
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.
J. R. Hindley and J. P. Seldin. Introduction to Combinators and λ-Calculus. Cambridge University Press, 1986.
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.
R. Hull and J. Su. On the Expressive Power of Database Queries with Intermediate Types. JCSS 43(1):219–267, 1991.
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.
G. Kuper and M. Y. Vardi. On the Complexity of Queries in the Logical Data Model. TCS 116:33–58, 1993.
G. M. Kuper and M. Y. Vardi. The Logical Data Model. ACM Trans. Database Syst. 18(3):379–413, 1993.
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).
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.
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.
M. Y. Vardi. The Complexity of Relational Query Languages. In Proc. 14th STOC, pp. 137–146, 1982.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1995 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Abiteboul, S., Hillebrand, G. (1995). Space usage in functional query languages. In: Gottlob, G., Vardi, M.Y. (eds) Database Theory — ICDT '95. ICDT 1995. Lecture Notes in Computer Science, vol 893. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-58907-4_33
Download citation
DOI: https://doi.org/10.1007/3-540-58907-4_33
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-58907-5
Online ISBN: 978-3-540-49136-1
eBook Packages: Springer Book Archive