A Set Theoretic Approach to Detecting Logic Bugs in DBMS InnerJoin Optimizations

Jimmc4141 pts0 comments

[2606.23294] A Set-Theoretic Approach to Detecting Logic Bugs in DBMS Inner Join Optimizations

Skip to main content

arXiv is now an independent nonprofit!<br>Learn more<br>&times;

Search arXiv

Press Enter to search &middot; Advanced search

-->

Computer Science > Databases

arXiv:2606.23294 (cs)

[Submitted on 22 Jun 2026 (v1), last revised 25 Jun 2026 (this version, v2)]

Title:A Set-Theoretic Approach to Detecting Logic Bugs in DBMS Inner Join Optimizations

Authors:Ce Lyu, Changzheng Wei, Yanhao Wang, Jie Liang, Li Lin, Hanghang Wu, Minghao Zhao, Ying Yan, Aoying Zhou<br>View a PDF of the paper titled A Set-Theoretic Approach to Detecting Logic Bugs in DBMS Inner Join Optimizations, by Ce Lyu and Changzheng Wei and Yanhao Wang and Jie Liang and Li Lin and Hanghang Wu and Minghao Zhao and Ying Yan and Aoying Zhou

View PDF<br>HTML (experimental)

Abstract:The query optimizer is a fundamental component of database management systems that determines the most efficient execution strategy for a given query by evaluating alternative query plans. Among its tasks, join optimization plays a central role, as the order of joins in multi-table queries can significantly affect execution performance. However, due to the inherent complexity of join optimization, logical bugs are inevitable and often difficult to detect. While existing fuzzing tools have shown notable success in uncovering crash- and performance-related errors, effectively identifying logical bugs -- cases in which the system produces incorrect query results -- remains largely unresolved.

In this paper, we propose a metamorphic testing approach to detect DBMS bugs related to INNER JOIN optimization through the lens of set theory. For each testing case, equivalent queries are generated based on a basic set operation -- intersection -- and three semantics-preserving transformation rules, i.e., symmetric join transformation, asymmetric difference transformation, and symmetric difference transformation, are introduced. These rules rewrite a simple NATURAL/INNER JOIN query into a more complex, yet semantically equivalent, form. We implement this design in JoinEquiv, which serves as a testing oracle to systematically uncover logical inconsistencies in DBMS query processing by comparing the results of original and transformed queries. Using JoinEquiv, we uncovered 29 previously unknown issues in mainstream DBMSs (MySQL, TiDB, DuckDB, and Percona), and 27 of them were officially confirmed. JoinEquiv reveals deep logical flaws in DBMS optimizers and executors, underscoring its value in enhancing DBMS robustness.

Subjects:

Databases (cs.DB); Software Engineering (cs.SE)

Cite as:<br>arXiv:2606.23294 [cs.DB]

(or<br>arXiv:2606.23294v2 [cs.DB] for this version)

https://doi.org/10.48550/arXiv.2606.23294

Focus to learn more

arXiv-issued DOI via DataCite

Submission history<br>From: Ce Lyu [view email]<br>[v1]<br>Mon, 22 Jun 2026 13:09:04 UTC (253 KB)

[v2]<br>Thu, 25 Jun 2026 05:44:57 UTC (253 KB)

Full-text links:<br>Access Paper:

View a PDF of the paper titled A Set-Theoretic Approach to Detecting Logic Bugs in DBMS Inner Join Optimizations, by Ce Lyu and Changzheng Wei and Yanhao Wang and Jie Liang and Li Lin and Hanghang Wu and Minghao Zhao and Ying Yan and Aoying Zhou<br>View PDF<br>HTML (experimental)<br>TeX Source

view license

Current browse context:

cs.DB

next >

new<br>recent<br>| 2026-06

Change to browse by:

cs<br>cs.SE

References & Citations

NASA ADS<br>Google Scholar

Semantic Scholar

export BibTeX citation<br>Loading...

BibTeX formatted citation

&times;

loading...

Data provided by:

Bookmark

Bibliographic Tools

Bibliographic and Citation Tools

Bibliographic Explorer Toggle

Bibliographic Explorer (What is the Explorer?)

Connected Papers Toggle

Connected Papers (What is Connected Papers?)

Litmaps Toggle

Litmaps (What is Litmaps?)

scite.ai Toggle

scite Smart Citations (What are Smart Citations?)

Code, Data, Media

Code, Data and Media Associated with this Article

alphaXiv Toggle

alphaXiv (What is alphaXiv?)

Links to Code Toggle

CatalyzeX Code Finder for Papers (What is CatalyzeX?)

DagsHub Toggle

DagsHub (What is DagsHub?)

GotitPub Toggle

Gotit.pub (What is GotitPub?)

Huggingface Toggle

Hugging Face (What is Huggingface?)

ScienceCast Toggle

ScienceCast (What is ScienceCast?)

Demos

Demos

Replicate Toggle

Replicate (What is Replicate?)

Spaces Toggle

Hugging Face Spaces (What is Spaces?)

Spaces Toggle

TXYZ.AI (What is TXYZ.AI?)

Related Papers

Recommenders and Search Tools

Link to Influence Flower

Influence Flower (What are Influence Flowers?)

Core recommender toggle

CORE Recommender (What is CORE?)

Author

Venue

Institution

Topic

About arXivLabs

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community,...

toggle dbms join bugs arxiv approach

Related Articles