arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

少数几行即可区分:混合集合语义与包语义的查询等价性

Few Rows Tell Them Apart: Equivalence of Queries Mixing Set and Bag Semantics

Sara Cohen

arXiv 2609.09978首次发表:更新:

发表机构

The Hebrew University of Jerusalem(耶路撒冷希伯来大学)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

本文为SQL查询等价性提供可计算的有界反例搜索界限,证明合取查询在有限元组内即可判定等价,并扩展至带比较的查询类。

AI 中文摘要

有界SQL等价性检查器搜索有界大小的反例数据库,而搜索返回空结果并不能证明任何东西。我们补充了缺失的理论:可计算的界限$B$,使得在所有每个关系最多有$B$个元组的数据库上的一致性意味着等价性。我们在组合语义框架下工作,该框架捕获了SQL在集合值关系上重复消除(DISTINCT)和重复保留计算的混合。对于合取查询,我们证明了在固定多重集宽度下,界限与查询大小呈线性关系:不等价的查询已经在最多$2^w |Q|$个元组的数据库上产生分歧,其中宽度$w$仅计算查询实际读取的列,与多重集变量的总数无关。声明的键将界限缩小到$2^{kw} |Q|$,其中较小的键宽度为$kw$,无环外键保持界限不变,并且结果扩展到几类带比较的查询,这些查询的等价性此前尚未被刻画。对于这些片段,有界搜索成为终止的、完备的决策过程。

英文摘要

Bounded SQL equivalence checkers search for a counter-example database of bounded size, and a search that comes back empty proves nothing. We supply missing theory: computable bounds $B$ such that agreement on all databases with at most $B$ tuples per relation implies equivalence. We work in the combined-semantics framework, which captures SQL's mix of duplicate-eliminating (DISTINCT) and duplicate-preserving computation over set-valued relations. For conjunctive queries we prove a bound linear in the query size for fixed multiset width: inequivalent queries already disagree on a database with at most $2^w |Q|$ tuples, where the width $w$ counts only the columns the queries actually read, independently of the total number of multiset variables. Declared keys shrink the bound to $2^{kw} |Q|$ for the smaller key-width $kw$, acyclic foreign keys leave it unchanged, and the result extends to several classes of queries with comparisons, for which equivalence had not previously been characterized. For these fragments, bounded search becomes a terminating, complete decision procedure.

Comments27 pages, including 10 pages of appendices; no figures

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑