一种查询语言中间表示的设计
Design of an intermediate representation for query languages
摘要:
面向数据的应用程序通常是用高级通用程序设计语言(如Java)编写的,通过粗糙的接口与数据库进行交互。非正式地说,查询的文本在应用程序端构建(通过普通的字符串连接或通过语句的抽象概念),并通过线路发送到执行它的数据库。然后将结果序列化并发送回“客户端代码”,在那里它们被翻译成语言的本地数据库。这种往返对性能是有害的,但更糟糕的是,这样的编程模型阻止了人们具有更丰富的查询,即包含用户定义函数(即由程序员定义并例如在SQL查询的过滤条件中使用的函数)的查询。虽然一些数据库也拥有“服务器端”语言(例如Oracle数据库中的PL/SQL),但它与非常优化的查询执行引擎的集成仍然很小,并且包含(PL/SQL)用户定义函数的查询仍然非常低效。在这种情况下,我们回顾了现有的语言集成查询框架,强调现有的数据库查询语言(包括SQL)共享高级查询原语(例如,过滤、连接、聚合),它们可以由运算符表示,但是在它们的表达语言的语义方面有很大的不同。为了以与应用程序语言和数据库无关的方式表示查询,我们设计了一个小演算,称为“QIR”的查询中间表示。QIR包含对应于纯λ演算的小扩展的表达式,以及表示常见查询基元的运算符。为了向数据库发送有效的查询,我们在QIR术语的测量中抽象出了“好”查询表示的想法。然后,我们设计了一个评估策略重写QIR查询表示为“更好”的。
英文摘要:
Data oriented applications, usually written in a high-level, general-purpose programming language (such as Java) interact with database through a coarse interface. Informally, the text of a query is built on the application side (either via plain string concatenation or through an abstract notion of statement) and shipped to the database over the wire where it is executed. The results are then serialized and sent back to the "client-code" where they are translated in the language's native datatypes. This round trip is detrimental to performances but, worse, such a programming model prevents one from having richer queries, namely queries containing user-defined functions (that is functions defined by the programmer and used e.g. in the filter condition of a SQL query). While some databases also possess a "server-side" language (e.g. PL/SQL in Oracle database), its integration with the very-optimized query execution engine is still minimal and queries containing (PL/SQL) user-defined functions remain notoriously inefficient. In this setting, we reviewed existing language-integrated query frameworks, highlighting that existing database query languages (including SQL) share high-level querying primitives (e.g., filtering, joins, aggregation) that can be represented by operators, but differ widely regarding the semantics of their expression language. In order to represent queries in an application language- and database-agnostic manner, we designed a small calculus, dubbed "QIR" for Query Intermediate Representation. QIR contains expressions, corresponding to a small extension of the pure lambda-calculus, and operators to represent usual querying primitives. In the effort to send efficient queries to the database, we abstracted the idea of "good" query representations in a measure on QIR terms. Then, we designed an evaluation strategy rewriting QIR query representations into "better" ones.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。