Complexity of higher-order queries

While relational algebra and calculus are a well-established foundation for classical database query languages, it is less clear what the analog is for higher-order functions, such as query transformations. Here we study a natural way to add higher-order functionality to query languages, by adding database query operators to the λ-calculus as constants. This framework, which we refer to as λ-embedded query languages, was introduced in [BPV10]. That work had a restricted focus: the containment and equivalence problems for query-to-query functions, in the case where only positive relational operators are allowed as constants. In this work we take an in-depth look at the most basic issue for such languages: the evaluation problem. We give a full picture of the complexity of evaluation for λ-embedded query languages, looking at a number of variations: with negation and without; with only relational algebra operators, and also with a recursion mechanism in the form of a query iteration operator; in a strongly-typed calculus as well as a weakly-typed one. We give tight bounds on both the combined complexity and the query complexity of evaluation in all these settings, in the process explaining connections with Datalog and prior work on λ-calculus evaluation.

[1]  Kenneth A. Ross On Negation in HiLog , 1994, J. Log. Program..

[2]  Scott Boag,et al.  XQuery 1.0 : An XML Query Language , 2007 .

[3]  Dexter Kozen,et al.  Lower bounds for natural proof systems , 1977, 18th Annual Symposium on Foundations of Computer Science (sfcs 1977).

[4]  Harry G. Mairson A Simple Proof of a Theorem of Statman , 1992, Theor. Comput. Sci..

[5]  Gottfried Vossen,et al.  Typed query languages for databases containing queries , 1998, Inf. Syst..

[6]  Jeffrey D. Ullman,et al.  Answering Queries Using Limited External Query Processors , 1999, J. Comput. Syst. Sci..

[7]  Jeffrey D. Ullman,et al.  Answering queries using limited external query processors (extended abstract) , 1996, PODS.

[8]  David S. Johnson,et al.  Testing containment of conjunctive queries under functional and inclusion dependencies , 1982, J. Comput. Syst. Sci..

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

[10]  Dirk Van Gucht,et al.  Converting nested algebra expressions into flat algebra expressions , 1992, TODS.

[11]  Michael Benedikt,et al.  Positive higher-order queries , 2010, PODS.

[12]  Alon Y. Halevy,et al.  Containment of Nested XML Queries , 2004, VLDB.

[13]  George H. L. Fletcher,et al.  On the Expressive Power of the Relational Algebra on Finite Sets of Relation Pairs , 2009, IEEE Transactions on Knowledge and Data Engineering.

[14]  Dan Suciu,et al.  Deciding containment for queries with complex objects (extended abstract) , 1997, PODS '97.

[15]  Nissim Francez,et al.  Basic simple type theory , 1998 .

[16]  Thomas Schwentick,et al.  Conjunctive query containment over trees , 2011, J. Comput. Syst. Sci..

[17]  Ronald Fagin,et al.  Inclusion dependencies and their interaction with functional dependencies , 1982, PODS.

[18]  Georg Gottlob,et al.  Complexity and expressive power of logic programming , 2001, CSUR.

[19]  Anthony K. H. Tung,et al.  Relaxing join and selection queries , 2006, VLDB.

[20]  Yannis Papakonstantinou,et al.  Expressive Capabilities Description Languages and Query Rewriting Algorithms , 2000, J. Log. Program..

[21]  Serge Abiteboul,et al.  Foundations of Databases , 1994 .

[22]  Wenfei Fan,et al.  Rewriting Regular XPath Queries on XML Views , 2007, 2007 IEEE 23rd International Conference on Data Engineering.

[23]  Y. Gurevich On Finite Model Theory , 1990 .

[24]  Kenneth A. Ross Relations with relation names as arguments: algebra and calculus , 1992, PODS '92.

[25]  Laks V. S. Lakshmanan,et al.  On the Logical Foundations of Schema Integration and Evolution in Heterogeneous Database Systems , 1993, DOOD.

[26]  Peter Buneman,et al.  Polymorphism and type inference in database programming , 1996, TODS.

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

[28]  Alfred V. Aho,et al.  Efficient optimization of a class of relational expressions , 1978, SIGMOD Conference.

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

[30]  Neil Immerman,et al.  Relational Queries Computable in Polynomial Time , 1986, Inf. Control..

[31]  Ashok K. Chandra,et al.  Optimal implementation of conjunctive queries in relational data bases , 1977, STOC '77.

[32]  Andrei Voronkov,et al.  Complexity of nonrecursive logic programs with complex values , 1998, PODS.

[33]  Peter Buneman,et al.  FQL: a functional query language , 1979, SIGMOD '79.

[34]  Jan Van den Bussche,et al.  Well-definedness and semantic type-checking for the nested relational calculus , 2007, Theor. Comput. Sci..

[35]  Jeremy Avigad Eliminating definitions and Skolem functions in first-order logic , 2003, TOCL.

[36]  Sihem Amer-Yahia,et al.  Tree Pattern Relaxation , 2002, EDBT.

[37]  Georg Gottlob,et al.  On the Complexity of Single-Rule Datalog Queries , 1999, LPAR.

[38]  Peter Buneman,et al.  Database programming in Machiavelli—a polymorphic language with static type inference , 1989, SIGMOD '89.

[39]  J. Girard,et al.  Proofs and types , 1989 .

[40]  Philip Wadler,et al.  Links: Web Programming Without Tiers , 2006, FMCO.

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

[42]  Andrew McGregor,et al.  Optimizing linear counting queries under differential privacy , 2009, PODS.

[43]  Paris C. Kanellakis,et al.  On the expressive power of simply typed and let-polymorphic lambda calculi , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[44]  Christoph Koch,et al.  On the complexity of nonrecursive XQuery and functional query languages on complex values , 2006, TODS.

[45]  Ezra Cooper,et al.  The Script-Writer's Dream: How to Write Great SQL in Your Own Language, and Be Sure It Will Succeed , 2009, DBPL.

[46]  Eberhard Karls,et al.  A Ferry-Based Query Backend for the Links Programming Language , 2011 .

[47]  Jan Van den Bussche,et al.  A crash course on database queries , 2007, PODS.

[48]  Jan Paredaens,et al.  On the Expressive Power of the Relational Algebra , 1978, Inf. Process. Lett..

[49]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[50]  Mihalis Yannakakis,et al.  Equivalences Among Relational Expressions with the Union and Difference Operators , 1980, J. ACM.

[51]  Aleksy Schubert The complexity of β-reduction in low orders , 2000 .

[52]  Alin Deutsch,et al.  Querying Data Sources that Export Infinite Sets of Views , 2011, ICDT '09.

[53]  Richard Statman,et al.  The typed λ-calculus is not elementary recursive , 1977, 18th Annual Symposium on Foundations of Computer Science (sfcs 1977).

[54]  François Bancilhon,et al.  On the Completeness of Query Languages for Relational Data Bases , 1978, MFCS.

[55]  Limsoon Wong,et al.  Kleisli, a functional query system , 2000, J. Funct. Program..

[56]  Michael Benedikt,et al.  From XQuery to relational logics , 2009, TODS.

[57]  Georg Gottlob,et al.  The impact of virtual views on containment , 2010, Proc. VLDB Endow..

[58]  Stijn Vansummeren,et al.  Deciding well-definedness of XQuery fragments , 2005, PODS.

[59]  Limsoon Wong,et al.  Naturally Embedded Query Languages , 1992, ICDT.

[60]  Jan Van den Bussche,et al.  Well-Definedness and Semantic Type-Checking in the Nested Relational Calculus and XQuery Extended Abstract , 2004, ICDT.

[61]  Jan Van den Bussche,et al.  Polymorphic Type Inference for the Relational Algebra , 2001, J. Comput. Syst. Sci..