Lune

VLDB2020Top-tier venue

Join on Samples: A Theoretical Guide for Practitioners

Dawei Huang, Dong Young Yoon, Seth Pettie, Barzan Mozafari

Abstract

Despite decades of research on AQP (approximate query processing), 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. Unfortunately, this early 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 realworld 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 in which each node acts autonomously using minimal statistics. We also empirically validate our findings on popular SQL and AQP engines.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

6 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers6

  1. Instance-Optimized Data Layouts for Cloud Analytics WorkloadsJialin Ding, Umar Farooq Minhas, Badrish Chandramouli, Chi Wang et al.SIGMOD 2021 · 37 citations
  2. Towards Observability for Production Machine Learning Pipelines [Vision]Shreya Shankar, Aditya G. ParameswaranVLDB 2022 · 21 citations
  3. Aggregate Queries on Knowledge Graphs: Fast Approximation with Semantic-aware SamplingYuxiang Wang, Arijit Khan, Xiaoliang Xu, Jiahui Jin et al.ICDE 2022 · 20 citations
  4. Towards Distribution-aware Query Answering in Data MarketsAbolfazl Asudeh, Fatemeh NargesianVLDB 2022 · 17 citations
  5. One Size Does Not Fit All: A Bandit-Based Sampler Combination Framework with Theoretical GuaranteesJinglin Peng, Bolin Ding, Jiannan Wang, Kai Zeng et al.SIGMOD 2022 · 7 citations

Builds on1

  1. QuickSel: Quick Selectivity Learning with Mixture ModelsYongjoo Park, Shucheng Zhong, Barzan MozafariSIGMOD 2020 · 66 citations

Related papers

  1. Enabling Adaptive Sampling for Intra-Window Join: Simultaneously Optimizing Quantity and QualityXilin Tang, Feng Zhang, Shuhao Zhang, Yani Liu et al.SIGMOD 2025 · 1 citation
  2. Weighted Distinct Sampling: Cardinality Estimation for SPJ QueriesYuan Qiu, Yilei Wang, Ke Yi, Feifei Li et al.SIGMOD 2021 · 10 citations
  3. QDBO: A Real-time Quantum-augmented Database System OptimizerHanwen Liu, Abhishek Kumar, Federico M. Spedalieri, Ibrahim SabekVLDB 2026 · 3 citations
  4. Improved Correlated Sampling for Join Size EstimationTaiNing Wang, Chee-Yong ChanICDE 2020 · 19 citations
  5. Accelerating Approximate Analytical Join Queries over Unstructured Data with Statistical GuaranteesYuxuan Zhu, Tengjun Jin, Chenghao Mo, Daniel KangSIGMOD 2026 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines