Building Efficient Query Engines in a High-Level Language
Not on the map. Why?
Abstract (arXiv)
Abstraction without regret refers to the vision of using high-level programming languages for systems development without experiencing a negative impact on performance. A database system designed according to this vision offers both increased productivity and high performance, instead of sacrificing the former for the latter as is the case with existing, monolithic implementations that are hard to maintain and extend. In this article, we realize this vision in the domain of analytical query processing. We present LegoBase, a query engine written in the high-level language Scala. The key technique to regain efficiency is to apply generative programming: LegoBase performs source-to-source compilation and optimizes the entire query engine by converting the high-level Scala code to specialized, low-level C code. We show how generative programming allows to easily implement a wide spectrum of optimizations, such as introducing data partitioning or switching from a row to a column data layout, which are difficult to achieve with existing low-level query compilers that handle only queries. We demonstrate that sufficiently powerful abstractions are essential for dealing with the complexity of the optimization effort, shielding developers from compiler internals and decoupling individual optimizations from each other. We evaluate our approach with the TPC-H benchmark and show that: (a) With all optimizations enabled, LegoBase significantly outperforms a commercial database and an existing query compiler. (b) Programmers need to provide just a few hundred lines of high-level code for implementing the optimizations, instead of complicated low-level code that is required by existing query compilation approaches. (c) The compilation overhead is low compared to the overall execution time, thus making our approach usable in practice for compiling query engines.
Key facts. Cited by 6 papers in the map (data through 13 Oct 2026). First posted on arXiv 16 Dec 2016.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 3; 2022: 1; 2023: 0; 2024: 0; 2025: 0; 2026: 2.
6 papers.
- 2021GeCo: Quality Counterfactual Explanations in Real Timecited by 32
- 2021Functional Collection Programming with Semi-Ring Dictionariescited by 6
- 2026GenDB: The Next Generation of Query Processing -- Synthesized, Not Engineeredcited by 1
- 2021Fine-Tuning Data Structures for Analytical Query Processingcited by 0
- 2022A Methodology and Software Architecture to Support Explainability-by-Designcited by 0
- 2026Demonstrating GenDB: Instance-Optimized and Customized Query Processing Code Generation via LLM Agentscited by 0
- 2026Demonstrating GenDB: Instance-Optimized and Customized Query Processing Code Generation via LLM Agents22 Jul 2026
- 2026GenDB: The Next Generation of Query Processing -- Synthesized, Not Engineered2 Mar 2026
- 2022A Methodology and Software Architecture to Support Explainability-by-Design13 Jun 2022
- 2021Fine-Tuning Data Structures for Analytical Query Processing24 Dec 2021
- 2021Functional Collection Programming with Semi-Ring Dictionaries10 Mar 2021
- 2021GeCo: Quality Counterfactual Explanations in Real Time5 Jan 2021