arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.00355cs.SEcs.DB
收藏

CERT:通过基数估计的视角发现数据库系统中的性能问题

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

Jinsheng Ba, Manuel Rigger

AI总结:

提出 CERT 技术,通过基数估计视角和黑盒测试方法发现数据库系统中的性能问题,在 MySQL、TiDB 和 CockroachDB 中发现 13 个问题,助力提升系统性能。

摘要:

数据库管理系统(DBMSs)通过创建随后执行的查询计划来处理给定查询,以计算查询结果。推导出高效的查询计划极具挑战性,学术界和工业界已投入数十年研究查询优化。尽管如此,DBMSs 仍易出现性能问题,即 DBMS 生成意外低效的查询计划,可能导致查询执行缓慢。发现此类问题是一个长期存在的问题且本质上非常困难,因为不存在关于预期执行时间的真实标签信息。在本研究中,我们提出了基数估计限制测试(CERT),这是一种通过基数估计视角发现性能问题的新技术。给定数据库上的查询,CERT 会推导出一个更具限制性的查询(例如,将 LEFT JOIN 替换为 INNER JOIN),其估计行数不应超过原始查询的估计行数。CERT 专门测试基数估计,因为基数估计被证明是查询优化最重要的部分;因此,我们预期发现并修复此类问题可能带来最高的性能提升。此外,我们发现其他类型的查询优化问题可以通过意外的估计基数暴露出来,这也可以由 CERT 发现。CERT 是一种黑盒技术,不需要访问源代码;DBMSs 通过 EXPLAIN 语句暴露查询计划。CERT 避免执行查询,因为执行查询成本高昂且容易出现性能波动。我们在三个广泛使用且成熟的 DBMSs(MySQL、TiDB 和 CockroachDB)上评估了 CERT。CERT 发现了 13 个独特问题,其中 2 个问题已修复,9 个已被开发者确认。我们期望这种发现性能错误的新视角能帮助 DBMS 开发者提升 DBMSs 的性能。

英文摘要:

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 they were shown to be the most important part for query optimization; thus, we expect that finding and fixing such 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑