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查询。理论分析表明,本文方法相比现有方法降低了时间复杂度,真实与合成实验也验证了这一结论。