How to Comprehend Queries Functionally |
| |
Authors: | Torsten Grust Marc H Scholl |
| |
Affiliation: | (1) Department of Computer and Information Science, University of Konstanz, D-78457 Konstanz, Germany |
| |
Abstract: | Compilers and optimizers for declarative query languages use some form of intermediate language to represent user-level queries. The advent of compositional query languages for orthogonal type systems (e.g., OQL) calls for internal query representations beyond extensions of relational algebra. This work adopts a view of query processing which is greatly influenced by ideas from the functional programming domain. A uniform formal framework is presented which covers all query translation phases, including user-level query language compilation, query optimization, and execution plan generation. We pursue the type-based design—based on initial algebras—of a core functional language which is then developed into an intermediate representation that fits the needs of advanced query processing. Based on the principle of structural recursion we extend the language by monad comprehensions (which provide us with a calculus-style sublanguage that proves to be useful during the optimization of nested queries) and combinators (abstractions of the query operators implemented by the underlying target query engine). Due to its functional nature, the language is susceptible to program transformation techniques that were developed by the functional programming as well as the functional data model communities. We show how database query processing can substantially benefit from these techniques. |
| |
Keywords: | databases query optimization structural recursion monad comprehensions program transformation |
本文献已被 SpringerLink 等数据库收录! |
|