NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Subset Sampling over Joins

Aryan Esmailpour, Xiao Hu, Jinchao Huang, Stavros Sintos

TL;DR

This paper introduces the first efficient algorithms for subset sampling (Poisson sampling) over acyclic relational joins without needing to materialize the entire join result. By leveraging weight-based bucketing and specialized indexing, the authors achieve near-optimal time and space complexity for static, one-shot, and dynamic streaming scenarios.

What Problem Does This Paper Address?

In modern data science, we rarely work with a single, flat table. Instead, data is spread across multiple relations that must be "joined" to create a training set or an analytical view. The problem is that the result of a join can be exponentially larger than the input tables—a phenomenon known as the materialization bottleneck. For example, joining tables of chemical compounds, proteins, and pathways in drug discovery could result in petabytes of data, even if the input tables are relatively small.

Researchers often use subset sampling (where each item is included in the sample independently based on a weight) to create manageable "coresets" for machine learning. However, until now, there was no efficient way to perform this specific type of sampling over joins. You either had to materialize the whole massive join first (slow and memory-intensive) or use techniques designed for uniform sampling, which don't account for the complex, derived weights (like binding affinity or clinical relevance) required in many real-world applications.

Methods

The authors propose a framework that "skips" over the vast majority of join results that would be rejected by the sampling process, operating directly on the input relations. Their approach centers on three main algorithmic contributions:

  1. Score-based Bucketing: They partition potential join results into buckets based on their "score" (the log of their probability). This transforms a non-uniform sampling problem into a series of near-uniform sub-problems.
  2. The DirectAccess Oracle: For acyclic joins, they build a specialized index that allows them to jump directly to the $i$-th result in a specific weight bucket in $O(\log N)$ time.
  3. Dynamic Maintenance: In streaming settings where new data is constantly being inserted, the authors use approximate statistics. By rounding counts to the nearest power of two, they can update the index much faster ($O(\log^3 N)$) while only introducing a constant factor of "dummy" tuples that are easily filtered out during sampling.

The algorithms support "decomposable" weight functions, meaning the probability of a join result can be calculated as the product, sum, minimum, or maximum of the weights of its constituent tuples.

Datasets

The paper is primarily theoretical and focuses on establishing algorithmic complexity and proving correctness. It does not include an empirical evaluation on specific real-world or benchmark datasets. Instead, it uses a hypothetical "virtual screening in drug discovery" scenario to motivate the problem and provides rigorous mathematical proofs for its complexity claims.

Key Insights and Ideas

  • Geometric Jumps: Instead of flipping a coin for every single join result, the algorithms use the geometric distribution to determine how many items to "skip" before the next successful sample. This is the key to bypassing the materialization bottleneck.
  • Acyclic Advantage: By focusing on acyclic joins (which can be represented as a tree), the authors can use dynamic programming to pre-calculate "W-values" (counts of results in subtrees) and "M-values" (aggregated counts), enabling efficient navigation of the join space.
  • The Power of Two: In the dynamic setting, the "aha moment" is realizing that exact counts are too expensive to maintain. By storing upper bounds rounded to the next power of two, they maintain a "dense" enough sample space to keep the sampling efficiency high while drastically reducing update costs.

Key Results

The authors demonstrate that subset sampling over joins is a "tractable database primitive." Their algorithms achieve the following complexities (where $N$ is input size and $\mu_\Psi$ is the expected sample size):

Scenario Preprocessing/Update Time Sampling Time Space Usage
Static Index $O(N \log N \log \log N)$ $O(1 + \mu_\Psi \log N)$ $O(N \log N)$
One-shot N/A $O(N \log^2 N + \mu_\Psi)$ $O(N \log^2 N + \mu_\Psi)$
Dynamic $O(\log^3 N \log \log N)$ (amortized) $O(\mu_\Psi \log N)$ $O(N \log N)$

These results are near-optimal, meaning the time spent is roughly proportional to the size of the input and the size of the sample you actually want to see.

Limitations and Future Work

  • Cyclic Joins: While the methods can be extended to cyclic joins using tree decomposition, this increases the effective input size based on the "fractional hypertree width," which can impact performance.
  • Weight Functions: The current framework is limited to standard aggregation functions (product, sum, min, max). It does not yet support complex, non-monotonic, or holistic functions.
  • Implementation: As a theoretical paper, the next logical step—which the authors acknowledge—is implementing these indexes in a real-world database system to evaluate their performance on actual machine learning workloads.

Summary updated

BibTeX
@article{esmailpour2026subset,
  author = {Aryan Esmailpour and Xiao Hu and Jinchao Huang and Stavros Sintos},
  title = {{Subset Sampling over Joins}},
  journal = {Proc. ACM Manag. Data},
  year = {2026},
  doi = {10.1145/3801913},
}
Figure