🤖 AI Summary
To address low cardinality estimation accuracy in database query optimization, this paper proposes QCardEst—the first end-to-end cardinality estimation algorithm based on quantum machine learning. Methodologically, it introduces a lightweight hybrid quantum-classical architecture: table-aware quantum state encoding (requiring only as many qubits as the number of tables), a single variational quantum circuit for compact SQL query representation, and the QCardCorr correction framework to post-process outputs from classical estimators. Its key contribution lies in pioneering the deployment of hardware-feasible quantum models for cardinality estimation—balancing practical quantum resource constraints with significant accuracy gains. Experimental evaluation on JOB-light and STATS benchmarks demonstrates that QCardEst outperforms the PostgreSQL query optimizer by 6.37× and 8.66×, respectively, and surpasses MSCN by 3.47× on JOB-light.
📝 Abstract
Cardinality estimation is an important part of query optimization in DBMS. We develop a Quantum Cardinality Estimation (QCardEst) approach using Quantum Machine Learning with a Hybrid Quantum-Classical Network. We define a compact encoding for turning SQL queries into a quantum state, which requires only qubits equal to the number of tables in the query. This allows the processing of a complete query with a single variational quantum circuit (VQC) on current hardware. In addition, we compare multiple classical post-processing layers to turn the probability vector output of VQC into a cardinality value. We introduce Quantum Cardinality Correction QCardCorr, which improves classical cardinality estimators by multiplying the output with a factor generated by a VQC to improve the cardinality estimation. With QCardCorr, we have an improvement over the standard PostgreSQL optimizer of 6.37 times for JOB-light and 8.66 times for STATS. For JOB-light we even outperform MSCN by a factor of 3.47.