paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Detecting optimization bugs in database engines via non-optimizing reference engine construction

通过构造非优化参考引擎检测数据库引擎中的优化缺陷
FSE Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2020匹配度 2/10 · 该论文属于数据库测试与差分测试方向,通过查询重写构造非优化参考引擎来检测优化缺陷,与用户关注的静态分析、LLM/Agent 改进程序分析、浮点程序分析等核心方向没有直接交集。虽然软件测试与程序分析有方法论上的邻近性,但既非静态分析,也不涉及 LLM/Agent 或浮点/贝叶斯程序分析。引用 100 inbox
Manuel Rigger, Zhendong Su
crossref: 2026-09-12

AI 速览

一句话:提出 NoREC,将查询重写为不可优化形式以构造非优化参考引擎,差分检测数据库优化缺陷。

数据库管理系统依赖复杂优化来高效访问数据,但错误优化会产生逻辑 bug,使查询返回错误结果集。为此,论文提出 NoREC 全自动方法:将任意(可随机生成)的优化查询重写为 DBMS 无法优化的等价查询,以此模拟非优化参考引擎,并比较优化版本与非优化版本返回结果集的差异来检测 bug。作者在 PostgreSQL、MariaDB、SQLite 和 CockroachDB 四个广泛使用的 DBMS 上开展大规模测试,共发现 159 个此前未知的 bug,其中 141 个已被开发者修复;51 个属于优化 bug,其余为错误和崩溃 bug。结果表明 NoREC 有效、通用且实现成本低。

问题
DBMS 的复杂查询优化可能引入逻辑 bug,使查询返回错误结果集;但 DBMS 通常不提供非优化执行版本,难以直接检测优化缺陷。
方法
提出 NoREC,核心是将任意(可随机生成的)优化查询重写为 DBMS 无法优化的等价查询,以此模拟非优化参考引擎,并差分比较优化与非优化执行的结果集来发现 bug。
评估
在 PostgreSQL、MariaDB、SQLite 和 CockroachDB 上大规模测试,发现 159 个未知 bug,141 个已修复,其中 51 个为优化 bug,其余为错误与崩溃 bug。
原文摘要(Abstract)

Database Management Systems (DBMS) are used ubiquitously. To efficiently access data, they apply sophisticated optimizations. Incorrect optimizations can result in logic bugs, which cause a query to compute an incorrect result set. We propose Non-Optimizing Reference Engine Construction (NoREC), a fully-automatic approach to detect optimization bugs in DBMS. Conceptually, this approach aims to evaluate a query by an optimizing and a non-optimizing version of a DBMS, to then detect differences in their returned result set, which would indicate a bug in the DBMS. Obtaining a non-optimizing version of a DBMS is challenging, because DBMS typically provide limited control over optimizations. Our core insight is that a given, potentially randomly-generated optimized query can be rewritten to one that the DBMS cannot optimize. Evaluating this unoptimized query effectively corresponds to a non-optimizing reference engine executing the original query. We evaluated NoREC in an extensive testing campaign on four widely-used DBMS, namely PostgreSQL, MariaDB, SQLite, and CockroachDB. We found 159 previously unknown bugs in the latest versions of these systems, 141 of which have been fixed by the developers. Of these, 51 were optimization bugs, while the remaining were error and crash bugs. Our results suggest that NoREC is effective, general and requires little implementation effort, which makes the technique widely applicable in practice.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot5817,
  title = {Detecting optimization bugs in database engines via non-optimizing reference engine construction},
  author = {Manuel Rigger and Zhendong Su},
  booktitle = {FSE},
  year = {2020},
  doi = {10.1145/3368089.3409710}
}