The relational calculus (RC) is a concise, declarative query language. However, existing RC query evaluation approaches are inefficient and often deviate from established algorithms based on finite tables used in database management systems. We devise a new translation of an arbitrary RC query into two safe-range queries, for which the finiteness of the query's evaluation result is guaranteed. Assuming an infinite domain, the two queries have the following meaning: The first is closed and characterizes the original query's relative safety, i.e., whether given a fixed database, the original query evaluates to a finite relation. The second safe-range query is equivalent to the original query, if the latter is relatively safe. We compose our translation with other, more standard ones to ultimately obtain two SQL queries. This allows us to use standard database management systems to evaluate arbitrary RC queries. We show that our translation improves the time complexity over existing approaches, which we also empirically confirm in both realistic and synthetic experiments.
翻译:关系演算(RC)是一种简洁、声明式的查询语言。然而,现有的RC查询评估方法效率低下,且往往偏离了数据库管理系统基于有限表使用的成熟算法。我们设计了一种新的转换方法,将任意RC查询转换为两个安全区间查询,从而保证查询评估结果的有限性。在假设无限域的前提下,这两个查询的含义如下:第一个查询是封闭的,用于刻画原始查询的相对安全性,即给定固定数据库时,原始查询是否评估为一个有限关系。第二个安全区间查询等价于原始查询(若后者相对安全)。我们将此转换与其他更标准的方法组合,最终生成两个SQL查询。这使得我们可以使用标准数据库管理系统来评估任意RC查询。我们证明,该转换相比现有方法降低了时间复杂度,并在真实与合成实验中对此进行了实证确认。