Detecting Logic Bugs of Join Optimizations in DBMS
Xiu Tang, Sai Wu, Dongxiang Zhang, Feifei Li, Gang Chen
Abstract
Generation-based testing techniques have shown their effectiveness in detecting logic bugs of DBMS, which are often caused by improper implementation of query optimizers. Nonetheless, existing generation-based debug tools are limited to single-table queries and there is a substantial research gap regarding multi-table queries with join operators. In this paper, we propose TQS, a novel testing framework targeted at detecting logic bugs derived by queries involving multi-table joins. Given a target DBMS, TQS achieves the goal with two key components: Data-guided Schema and Query Generation (DSG) and Knowledge-guided Query Space Exploration (KQE). DSG addresses the key challenge of multi-table query debugging: how to generate ground-truth (query, result) pairs for verification. It adopts the database normalization technique to generate a testing schema and maintains a bitmap index for result tracking. To improve debug efficiency, DSG also artificially inserts some noises into the generated data. To avoid repetitive query space search, KQE forms the problem as isomorphic graph set discovery and combines the graph embedding and weighted random walk for query generation. We evaluated TQS on four popular DBMSs: MySQL, MariaDB, TiDB and the gray release of an industry-leading cloud-native database, anonymized as X-DB. Experimental results show that TQS is effective in finding logic bugs of join optimization in database management systems. It successfully detected 115 bugs within 24 hours, including 31 bugs in MySQL, 30 in MariaDB, 31 in TiDB, and 23 in X-DB respectively.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
17 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Keep It Simple: Testing Databases via Differential Query Plans cites Finding bugs in database systems via query partitioning
- Keep It Simple: Testing Databases via Differential Query Plans cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Keep It Simple: Testing Databases via Differential Query Plans cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Keep It Simple: Testing Databases via Differential Query Plans cites Testing Database Engines via Pivoted Query Synthesis
- Scaling Automated Database System Testing cites Keep It Simple: Testing Databases via Differential Query Plans
- Scaling Automated Database System Testing cites Constant Optimization Driven Database System Testing
- Scaling Automated Database System Testing cites Finding bugs in database systems via query partitioning
- Scaling Automated Database System Testing cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Scaling Automated Database System Testing cites Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation
- Scaling Automated Database System Testing cites Testing Database Engines via Pivoted Query Synthesis
- Constant Optimization Driven Database System Testing cites Finding bugs in database systems via query partitioning
- Constant Optimization Driven Database System Testing cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Constant Optimization Driven Database System Testing cites Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation
- Constant Optimization Driven Database System Testing cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Constant Optimization Driven Database System Testing cites Testing Database Engines via Pivoted Query Synthesis
- Understanding and Reusing Test Suites Across Database Systems cites Finding bugs in database systems via query partitioning
- Understanding and Reusing Test Suites Across Database Systems cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Understanding and Reusing Test Suites Across Database Systems cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Understanding and Reusing Test Suites Across Database Systems cites Testing Database Engines via Pivoted Query Synthesis
- Finding bugs in database systems via query partitioning cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Finding bugs in database systems via query partitioning cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Finding bugs in database systems via query partitioning cites Testing Database Engines via Pivoted Query Synthesis
- Detecting optimization bugs in database engines via non-optimizing reference engine construction cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Detecting optimization bugs in database engines via non-optimizing reference engine construction cites Testing Database Engines via Pivoted Query Synthesis
- Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation cites Finding bugs in database systems via query partitioning
- Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
- Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
- Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation cites Testing Database Engines via Pivoted Query Synthesis
Cited by top-tier papers17
- Keep It Simple: Testing Databases via Differential Query PlansJinsheng Ba, Manuel RiggerSIGMOD 2024 · 23 citations
- Detecting Logic Bugs in Database Engines via Equivalent Expression TransformationZu-Ming Jiang, Zhendong SuOSDI 2024 · 22 citations
- Constant Optimization Driven Database System TestingChi Zhang, Manuel RiggerSIGMOD 2025 · 8 citations
- Scaling Automated Database System TestingSuyang Zhong, Manuel RiggerASPLOS 2026 · 4 citations
- Understanding and Reusing Test Suites Across Database SystemsSuyang Zhong, Manuel RiggerSIGMOD 2025 · 4 citations
Builds on6
- Testing Database Engines via Pivoted Query SynthesisManuel Rigger, Zhendong SuOSDI 2020 · 150 citations
- Finding bugs in database systems via query partitioningManuel Rigger, Zhendong SuOOPSLA 2020 · 116 citations
- Detecting optimization bugs in database engines via non-optimizing reference engine constructionManuel Rigger, Zhendong SuFSE 2020 · 104 citations
- APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database SystemsJinho Jung, Hong Hu, Joy Arulraj, Taesoo Kim et al.VLDB 2020 · 77 citations
- Efficient Bi-triangle Counting for Large Bipartite NetworksYixing Yang, Yixiang Fang, Maria E. Orlowska, Wenjie Zhang et al.VLDB 2021 · 39 citations
Related papers
- SRS: Detecting Logic Bugs of Join Implementation in DBMSs via Set Relation SynthesisJinhui Lai, Chi Zhang, Bingyan Li, Chenglin Liang et al.SIGMOD 2026 · 4 citations
- Testing Database Systems via Differential Query ExecutionJiansen Song, Wensheng Dou, Ziyu Cui, Qianwang Dai et al.ICSE 2023 · 26 citations
- A Set-Theoretic Approach to Detecting Logic Bugs in DBMS Inner Join OptimizationsCe Lyu, Changzheng Wei, Yanhao Wang, Jie Liang et al.ICDE 2026
- Testing Graph Databases with Synthesized QueriesZijing Yin, Si Liu, David A. BasinSIGMOD 2026 · 2 citations
- Detecting Join Bugs in Database Engines via Join Implication ReasoningZhaokun Xiang, Suyang Zhong, Manuel RiggerSIGMOD 2026
