[Paper Review] Joins on Samples: A Theoretical Guide for Practitioners
This paper provides a theoretical foundation for approximating equi-joins using offline samples, showing that optimal sampling strategies—specifically a hybrid scheme combining stratified, universe, and Bernoulli sampling—can achieve variance within a constant factor of the information-theoretic lower bound. It introduces a decentralized variant for practical deployment, enabling accurate, low-overhead join estimation without full data shuffling.
Despite decades of research on approximate query processing (AQP), our understanding of sample-based joins has remained limited and, to some extent, even superficial. The common belief in the community is that joining random samples is futile. This belief is largely based on an early result showing that the join of two uniform samples is not an independent sample of the original join, and that it leads to quadratically fewer output tuples. However, unfortunately, this result has little applicability to the key questions practitioners face. For example, the success metric is often the final approximation's accuracy, rather than output cardinality. Moreover, there are many non-uniform sampling strategies that one can employ. Is sampling for joins still futile in all of these settings? If not, what is the best sampling strategy in each case? To the best of our knowledge, there is no formal study answering these questions. This paper aims to improve our understanding of sample-based joins and offer a guideline for practitioners building and using real-world AQP systems. We study limitations of offline samples in approximating join queries: given an offline sampling budget, how well can one approximate the join of two tables? We answer this question for two success metrics: output size and estimator variance. We show that maximizing output size is easy, while there is an information-theoretical lower bound on the lowest variance achievable by any sampling strategy. We then define a hybrid sampling scheme that captures all combinations of stratified, universe, and Bernoulli sampling, and show that this scheme with our optimal parameters achieves the theoretical lower bound within a constant factor. Since computing these optimal parameters requires shuffling statistics across the network, we also propose a decentralized variant where each node acts autonomously using minimal statistics.
Motivation & Objective
- To address the long-standing misconception that joining uniform samples is inherently futile for approximate query processing (AQP).
- To formally analyze the limitations of offline sampling in approximating equi-joins under two key success metrics: output size and estimator variance.
- To derive an information-theoretically optimal sampling strategy that minimizes variance, achieving performance within a constant factor of the theoretical lower bound.
- To design a decentralized sampling variant that enables practical deployment with minimal network communication of statistics.
- To validate the theoretical findings empirically on real-world SQL and AQP engines, demonstrating practical accuracy and efficiency.
Proposed method
- Proposes a hybrid sampling scheme that unifies stratified, universe, and Bernoulli sampling into a single framework, parameterized by sampling rates for each component.
- Derives an information-theoretic lower bound on the minimum achievable variance for any offline sampling strategy on equi-joins.
- Identifies optimal sampling parameters for the hybrid scheme that achieve variance within a constant factor of this lower bound.
- Introduces a decentralized variant where each node computes its own optimal sampling parameters using only local statistics, avoiding global coordination.
- Employs variational subsampling and statistical estimation techniques to ensure accurate approximation of aggregate functions (e.g., COUNT, SUM) on the join result.
- Validates the approach using real-world AQP engines (e.g., VerdictDB, Quickr) and synthetic workloads to measure accuracy and speedup.
Experimental results
Research questions
- RQ1Is joining uniform samples truly futile for approximate equi-joins, or can non-uniform sampling strategies achieve high accuracy?
- RQ2What is the theoretical minimum variance achievable by any offline sampling strategy for equi-joins, and can this bound be approached in practice?
- RQ3Can a unified sampling framework capture the benefits of stratified, universe, and Bernoulli sampling while minimizing variance?
- RQ4How can optimal sampling parameters be computed efficiently in a decentralized manner without full network coordination?
- RQ5To what extent do the theoretical findings translate into practical accuracy gains on real AQP systems?
Key findings
- The paper establishes an information-theoretic lower bound on the variance of any offline sampling strategy for equi-joins, providing a benchmark for optimal performance.
- The proposed hybrid sampling scheme with optimally tuned parameters achieves variance within a constant factor of this theoretical lower bound.
- The decentralized variant of the sampling scheme enables each node to compute its own optimal sampling parameters using only local statistics, significantly reducing communication overhead.
- Empirical evaluation on SQL and AQP engines confirms that the proposed method achieves high accuracy with substantial speedups, outperforming uniform and universe sampling.
- The results show that joining offline samples is not futile when using optimal non-uniform sampling strategies, especially when the join column distribution is skewed.
- The framework improves accuracy for database learning and selectivity estimation by providing more representative samples of the join result.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.