TL;DR
The PASS (Precomputation-Assisted Stratified Sampling) framework combines the speed of pre-computed data aggregates with the flexibility of statistical sampling to solve the "selective query" problem in Approximate Query Processing (AQP). By optimally partitioning data into a tree structure, PASS provides significantly higher accuracy and—uniquely—deterministic "hard bounds" for query results that pure sampling methods cannot offer.
What Problem Does This Paper Address?
Approximate Query Processing (AQP) is the art of giving a "good enough" answer to a database query in milliseconds instead of minutes. Traditionally, this is done via sampling: you look at 1% of the data and guess the total.
However, sampling has a major "needle in a haystack" problem. If you ask a very selective query (e.g., "Average temperature in Room 402 between 3:01 and 3:02 AM"), a random 1% sample might contain zero records from that specific window, leading to massive errors or misleading results.
On the other end of the spectrum is precomputation: calculating every possible answer in advance. This is perfectly accurate but consumes massive storage and lacks flexibility for ad-hoc queries. This paper addresses the lack of a unified theory on how to combine these two worlds—aggregates and samples—optimally to minimize error across a wide range of potential queries.
Methods
The authors introduce PASS (Precomputation-Assisted Stratified Sampling). The core idea is to build a "Partition Tree" (similar to a k-d tree) where:
- Internal Nodes store exact pre-computed aggregates (SUM, COUNT, MIN, MAX) for specific regions of the data.
- Leaf Nodes contain stratified samples of the data within those regions.
The Query Logic: When a query arrives, PASS uses a Minimal Coverage Frontier (MCF) algorithm. If a data partition is entirely contained within the query's filter, PASS uses the exact pre-computed aggregate. If a partition only partially overlaps with the query, PASS uses the stratified samples from that leaf to estimate the remainder.
The Optimization: The "secret sauce" is how PASS decides where to draw the boundaries for these partitions. The authors developed a Dynamic Programming (DP) algorithm that finds a partitioning scheme to minimize the maximum sampling variance (the worst-case error) for a set of expected queries. They provide a "nearly optimal" guarantee, proving that their approximation is within a small constant factor of the theoretical best partitioning.
Datasets
The framework was evaluated on three diverse, real-world datasets:
- Intel Wireless Dataset: 3 million rows of IoT sensor data (humidity, temperature, etc.).
- Instacart Online Grocery Dataset: 1.4 million entries of retail orders.
- NYC Taxi Trip Records: 7.7 million records of taxi trips in New York City, used for complex multi-dimensional query testing.
Key Insights and Ideas
- Aggregates as an Index: Instead of viewing pre-computed aggregates just as "cached answers," PASS treats them as an index that guides the sampling process, allowing the system to "skip" large chunks of data that are already exactly accounted for.
- The "Hard Bound" Advantage: Because PASS knows the true MIN and MAX of every partition, it can provide a 100% confidence interval (e.g., "The average is definitely between 42 and 46"). Purely sample-based systems can only give probabilistic estimates (e.g., "We are 95% sure it's between 40 and 48").
- Zero-Variance Rule: If a partition has a MIN equal to its MAX (meaning all values are the same), PASS treats it as a "covered" node even if the query only partially overlaps it, further reducing sampling error.
- Workload Robustness: Even if a query doesn't perfectly align with the pre-computed boundaries, the hierarchical nature of the tree ensures that the "exact" component of the answer remains as large as possible.
Key Results
- Superior Accuracy: In tests across all three datasets, PASS achieved a median relative error of less than 0.1% for SUM/COUNT/AVG queries, significantly outperforming uniform sampling, standard stratified sampling, and the state-of-the-art AQP++ baseline.
- Selective Query Performance: PASS remained stable even as queries became more selective, whereas the error in uniform sampling spiked as the "effective sample size" dropped.
- Efficiency: While PASS has a higher upfront construction cost (e.g., ~23 seconds to optimize vs. ~0.1 seconds for a simple sample), it pays off in query-time accuracy. Once built, it evaluates results about 13% faster than standard sampling due to aggressive data skipping.
Limitations and Future Work
- Upfront Cost: PASS requires a significant pre-processing phase to run the DP optimization. It is best suited for data warehouses where data is "read-heavy" and changes slowly.
- Dimensionality: The construction time for the optimal partition tree scales exponentially with the number of predicate columns ($d$). While the authors use heuristics for higher dimensions, finding a truly optimal multi-dimensional partition remains a challenge.
- Dynamic Updates: While the paper discusses how to handle new insertions using Reservoir Sampling, the impact of frequent updates on the "optimality" of the tree structure over time is an area for further study.
Summary updated