Learned Approximate Query Processing: Make it Light, Accurate and Fast

Qingzhi Ma, Ali Mohammadi Shanghooshabad, Mehrdad Almasi, Meghdad Kurmanji, Peter TriantafillouCIDR 2021

Abstract

DBEst++ is a next-generation "learned" Approximate Query Processing (AQP) engine designed to overcome the limitations of traditional data sampling. By replacing large samples with lightweight machine learning models—specifically Mixture Density Networks (MDNs) and word embeddings—DBEst++ achieves up to three orders of magnitude in memory savings and significantly higher accuracy than current state-of-the-art approaches.

Introduction

In modern big data environments, executing exact analytical queries (e.g., SUM, AVG, COUNT) over billions of records is often prohibitively slow. Traditional database systems address this using Approximate Query Processing (AQP), which provides rapid, "good enough" answers based on data samples. However, sampling-based AQP faces a trade-off: high accuracy requires large samples that consume excessive memory and increase latency.

Recent "learned" AQP methods attempt to "memorize" data distributions using machine learning. Yet, existing models are often either too bulky or struggle with categorical data and incremental updates. DBEst++ introduces a "Goldilocks" solution: a system of specialized, lightweight models that are small enough to fit in a cache while remaining accurate and fast.

System Architecture

The DBEst++ framework moves away from traditional Kernel Density Estimators (KDEs) toward a sophisticated neural architecture. The system is designed to be "embarrassingly parallelizable," scaling linearly with available CPU cores.

The DBEst++ Architecture, illustrating the flow from SQL parsing to model-based result generation.

As shown in the architecture, a Model Manager selects specialized models for specific queries, while a Model Trainer handles the creation of these models from data samples. The Model Container stores the resulting metadata, embeddings, and MDN components.

Technical Pillars

DBEst++ relies on two primary innovations to achieve its performance:

1. Mixture Density Networks (MDNs)

Unlike standard regressors that predict a single point value, MDNs predict a probability distribution—specifically a mixture of Gaussians. This allows the engine to mathematically integrate over ranges to answer aggregate queries with high precision.

The MDN architecture, showing how hidden layers produce mixture coefficients (weight, mean, variance) to form a mixture distribution.

By outputting parameters for a mixture distribution, DBEst++ can perform closed-form calculations for complex aggregates like VARIANCE, avoiding the heavy computational overhead of traditional methods.

2. Word Embeddings for Categorical Data

To handle categorical variables (e.g., city names), DBEst++ utilizes Skip-Gram word embeddings. By treating database values like words in a natural language context, it maps categories into a continuous vector space. This ensures that semantically similar values are positioned closely, making it easier for the neural network to learn underlying patterns compared to sparse "one-hot" encoding.

Evaluation and Results

The researchers evaluated DBEst++ against industry-standard benchmarks (TPC-DS) and a real-world Flights dataset scaled to 1 billion tuples. It was compared against DeepDB (learned AQP) and VerdictDB (sampling-based AQP).

  • Memory Efficiency: DBEst++ achieved a memory footprint roughly three orders of magnitude smaller than its competitors. For the 1-billion-tuple Flights dataset, the model required only 35 KB, compared to 4.3 MB for DeepDB.
  • Accuracy: On TPC-DS, DBEst++ maintained a relative error of 1.09%, outperforming DeepDB’s 1.30%–2.13%.
  • Latency: Query response times were 25% to 40% faster than DeepDB. In parallelized environments, a complex query involving 50,000 groups saw response times drop from 13.38 seconds to 0.78 seconds on 20 cores.

Conclusion and Future Work

DBEst++ demonstrates that specialized, lightweight models can outperform universal models in both size and accuracy. While the system excels at data insertions and rapid querying, future work is needed to support complex updates and deletions. Additionally, the authors aim to develop formal error guarantees and "concept drift" detection to maintain model reliability as underlying data distributions evolve.

Summary updated

BibTeX
@inproceedings{ma2021learned,
  author = {Qingzhi Ma and Ali Mohammadi Shanghooshabad and Mehrdad Almasi and Meghdad Kurmanji and Peter Triantafillou},
  title = {{Learned Approximate Query Processing: Make it Light, Accurate and Fast}},
  booktitle = {CIDR},
  year = {2021},
}
Figure