paperbot · PL 论文追踪

全部论文 待读 收藏

P2 CERT: Finding Performance Issues in Database Systems Through the Lens of Cardinality Estimation

CERT:从基数估计视角发现数据库系统中的性能问题
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 1/10 · 该论文研究数据库系统查询优化中的基数估计性能问题,属于DBMS黑盒测试与调试,与用户关注的PL/AI交叉、静态分析、浮点程序分析、贝叶斯程序分析以及LLM/Agent均无直接关系。引用 16 inbox
Jinsheng Ba, Manuel Rigger
crossref: 2026-09-12

AI 速览

一句话:提出黑盒技术 CERT,通过构造更受限查询检测基数估计违例,从而发现 DBMS 性能问题。

数据库管理系统通过查询计划执行查询,但常因选择低效计划而出现性能问题;由于缺少期望执行时间的基准真值,这类问题长期难以发现。本文提出基数估计限制测试(CERT):给定数据库上的一个查询,CERT 派生出一个更受限的查询(例如把 LEFT JOIN 替换为 INNER JOIN),并断言其估计行数不应超过原查询的估计行数,从而检测基数估计中的违例。CERT 专门针对基数估计,因为它是查询优化中最重要的环节,修复其问题可能带来最大性能收益;同时作者发现其他类型的查询优化问题也可借由异常的估计基数暴露出来。CERT 是黑盒技术,无需源码,仅通过 EXPLAIN 语句获取查询计划,且不执行查询,避免了执行开销与性能波动。作者在 MySQL、TiDB 和 CockroachDB 三个成熟且广泛使用的 DBMS 上评估,共发现 13 个独特问题,其中 2 个已被修复、9 个被开发者确认。

问题
DBMS 可能生成意外低效的查询计划并导致查询执行缓慢,但由于不存在期望执行时间的基准真值,发现此类性能问题本质困难。
方法
提出 CERT:对给定查询派生更受限的查询(如 LEFT JOIN 改为 INNER JOIN),断言其估计基数不应超过原查询;仅借助 EXPLAIN 获取计划做黑盒检查,不执行查询。
评估
在 MySQL、TiDB 与 CockroachDB 三个成熟 DBMS 上评估,共发现 13 个独特问题,其中 2 个已修复、9 个被开发者确认。
原文摘要(Abstract)

Database Management Systems (DBMSs) process a given query by creating a query plan, which is subsequently executed, to compute the query's result. Deriving an efficient query plan is challenging, and both academia and industry have invested decades into researching query optimization. Despite this, DBMSs are prone to performance issues, where a DBMS produces an unexpectedly inefficient query plan that might lead to the slow execution of a query. Finding such issues is a longstanding problem and inherently difficult, because no ground truth information on an expected execution time exists. In this work, we propose Cardinality Estimation Restriction Testing (CERT), a novel technique that finds performance issues through the lens of cardinality estimation. Given a query on a database, CERT derives a more restrictive query (e.g., by replacing a LEFT JOIN with an INNER JOIN), whose estimated number of rows should not exceed the estimated number of rows for the original query. CERT tests cardinality estimation specifically, because it was shown to be the most important part for query optimization; thus, we expect that finding and fixing cardinality-estimation issues might result in the highest performance gains. In addition, we found that other kinds of query optimization issues can be exposed by unexpected estimated cardinalities, which can also be found by CERT. CERT is a black-box technique that does not require access to the source code; DBMSs expose query plans via the EXPLAIN statement. CERT eschews executing queries, which is costly and prone to performance fluctuations. We evaluated CERT on three widely used and mature DBMSs, MySQL, TiDB, and CockroachDB. CERT found 13 unique issues, of which 2 issues were fixed and 9 confirmed by the developers. We expect that this new angle on finding performance bugs will help DBMS developers in improving DMBSs' performance.

链接与引用

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

BibTeX
@inproceedings{paperbot11345,
  title = {CERT: Finding Performance Issues in Database Systems Through the Lens of Cardinality Estimation},
  author = {Jinsheng Ba and Manuel Rigger},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639076}
}