Space Usage in Functional Query Languages

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.

[1]  Paris C. Kanellakis,et al.  Functional database query languages as typed lambda calculi of fixed order (extended abstract) , 1994, PODS '94.

[2]  Gerd G. Hillebrand Finite model theory in the simply typed lambda calculus , 1994 .

[3]  Dan Suciu,et al.  Any algorithm in the complex object algebra with powerset needs exponential space to compute transitive closure , 1994, PODS '94.

[4]  Catriel Beeri,et al.  On the power of languages for manipulation of complex objects , 1987, VLDB 1987.

[5]  Jianwen Su,et al.  On the expressive power of database queries with intermediate types , 1988, PODS '88.

[6]  Jianwen Su,et al.  On the Expressive Power of Database Queries with Intermediate Types , 1991, J. Comput. Syst. Sci..

[7]  Moshe Y. Vardi The complexity of relational query languages (Extended Abstract) , 1982, STOC '82.

[8]  Sheila A. Greibach,et al.  Theory of Program Structures: Schemes, Semantics, Verification , 1976, Lecture Notes in Computer Science.

[9]  Harry G. Mairson,et al.  Database Query Languages Embedded in the Typed Lambda Calculus , 1996, Inf. Comput..

[10]  Alfred V. Aho,et al.  Universality of data retrieval languages , 1979, POPL.

[11]  A. Church The calculi of lambda-conversion , 1941 .

[12]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[13]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[14]  Gabriel M. Kuper,et al.  The logical data model , 1993, TODS.

[15]  John W. Backus,et al.  Can programming be liberated from the von Neumann style?: a functional style and its algebra of programs , 1978, CACM.

[16]  Gabriel M. Kuper,et al.  On the Complexity of Queries in the Logical Data Model , 1993, Theor. Comput. Sci..

[17]  Serge Abiteboul,et al.  Method schemas , 1990, PODS.

[18]  E. F. Codd,et al.  A relational model of data for large shared data banks , 1970, CACM.

[19]  Bruno Courcelle,et al.  Recursive Applicative Program Schemes , 1991, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[20]  Robin Milner The standard ML core language , 1984 .

[21]  Harry G. Mairson,et al.  Unification and ML-Type Reconstruction , 1991, Computational Logic - Essays in Honor of Alan Robinson.

[22]  Sridhar Ramaswamy,et al.  Functional Programming Formalisms for OODBMS Methods , 1993, NATO ASI OODBS.

[23]  David Harel,et al.  Computable Queries for Relational Data Bases , 1980, J. Comput. Syst. Sci..

[24]  BackusJohn Can programming be liberated from the von Neumann style , 1978 .

[25]  Peter Buneman,et al.  An implementation technique for database query languages , 1982, TODS.

[26]  Robin Milner,et al.  A Metalanguage for interactive proof in LCF , 1978, POPL.

[27]  J. Roger Hindley,et al.  Introduction to combinators and λ-calculus , 1986, Acta Applicandae Mathematicae.