Bound to be Complete: Efficient Verification for SQL Equivalence via U-Expressions
Haoran Ding, Zhaoguo Wang, Zuming Jiang, Haibo Chen, Jinyang Li, Ruzica Piskac
Abstract
Automated verification of SQL query equivalence is a fundamental problem in database area. Recent works developed verifiers with guaranteed completeness, which can generate counterexamples to disprove non-equivalent queries and are useful in various scenarios. However, they have to solve complex formulas and can fail to produce counterexamples within a reasonable time budget. This paper presents a new complete verifier called SQLution, which not only greatly reduces the verification time, but also supports more SQL features. The key insight is to represent SQL semantics using U-expression, a functional algebra that can model SQL with significantly simpler formulas than prior works, thereby leading to more efficient SMT solving. To turn this insight into a practical verifier, SQLution further tackles two technical challenges associated with modeling SQL using U-expression, namely, the lack of tuple ordering and the presence of unbounded summations. In particular, to support tuple ordering, SQLution proposes order semantics encoding which combines U-expressions with first-order logic. To handle unbounded summation, SQLution introduces unbounded summation expansion to transform them into bounded summations, which can be directly encoded into FOL formulas. Evaluation shows that compared with state-of-the-art verifiers, SQLution can support all 271 non-equivalent query pairs derived from the Spider dataset and reduces verification time by up to 98.6%.
Create a lesson
Metadata
- Categories
- cs.DB, cs.LO
Related papers
Bounded Treewidth Rulesets Are Not Finitely Controllable
Shared title terminologycs.DBPiotr Ostropolski-Nalewaja, Michaël Thomazo
Highly Efficient Vertical Federated Clustering with Triangle-Inequality-based Pruning
Shared title terminologycs.DBFeiteng Nie, Shengkun Zhu, Zepeng Liu et al.
A Gaussian Primitive Data Management Framework for Efficient 3DGS Trajectory Rendering
Shared title terminologycs.DBHaolun Ma, Ziyi Liu, Zizhuo Xu et al.
Read Boundaries in Agent Memory: Consistency, Completeness, and Repair
Shared title terminologycs.DBHaoting Qiu, Qibai Chen
KaleidoKV: Rearranging Evidence for Efficient KV Cache Reuse in Offline RAG Inference
Shared title terminologycs.DBPeiting Xie, Xingyu Tan, Xiangjun Zai et al.
Calibrated Early Termination with Bounded Optimality Gaps for Constrained Vector Search
Shared title terminologycs.DBXinyu Zhang, Jingze Li, Baihua Zheng et al.