SQL2SQLBench: A Benchmark for Database Dialect Translation
Abstract
SQL dialect translation refers to converting a SQL query from one dialect to its equivalent in another dialect. Automating this process is crucial for streamlining database migrations and ensuring cross-system compatibility. Although there are many rule-based and LLM-based dialect translators, the field lacks comprehensive benchmarks to evaluate their effectiveness across diverse real-world scenarios. To address this problem, we propose SQL2SQLBench, a comprehensive benchmark for database dialect translation. First, we generate a comprehensive dataset with broad coverage in schemas, data values, and diverse dialects, grounded in real-world sources. Second, we propose Translation Point Definition Language (TPDL) to break down translation behaviors into a sequence of translation points (i.e., atomic translation of individual SQL syntactic segments across dialects). Using TPDL, we generate a comprehensive set of SQL translation pairs with fine-grained coverage of translation points, mimicking real-world queries. Third, to evaluate whether SQL dialect translators can correctly translate a source query from one dialect to a target query in another dialect, we design a progressive translation equivalence verification pipeline that combines execution-based verification with dialect-adapted formal verification. Finally, we evaluate state-of-the-art dialect translators using our open-sourced testbed and provide detailed insights.
Create a lesson
Metadata
- Comments
- 12 pages, 6 figures, 10 tables. Code and benchmark are available at https://github.com/TsinghuaDatabaseGroup/SQL2SQLBench
Related papers
MAP-Bench: Benchmarking Cross-Model Analytical Pipelines in Multi-Model Database Systems
Shared title terminologycs.DBYuhan He, Tiezheng Nie, Zihao Wen et al.
[Experiment, Analysis, and Benchmark] How well do LLMs comprehend and design relational database schemata?
Shared title terminologycs.DBSriom Chakrabarti, Sean Bin Yang, Arijit Khan et al.
Diagnose Before You Tune: Agentic Bottleneck Diagnosis for Database Tuning
Shared title terminologycs.DBXinyue Yang, Chaozheng Wang, Chen Zheng et al.
Beyond the Bulk-Load Honeymoon: Longitudinal Benchmarking of Learned Indexes Under Sustained Storage Workloads
Shared title terminologycs.DBEmmilly Immaculate Namuganga, Laurent Bindschaedler
Toward Relational-Vector Databases with Schema-Structured Embeddings
Shared title terminologycs.DBAbolfazl Asudeh, Mohsen Dehghankar, Mahdi Erfanian
Toward Database-Native Genomics: A Vision for Declarative Genomic Analysis
Shared title terminologycs.DBDhruv Aron, Danial Saleem, James Christopher Sorenson et al.