Cost-based Selection of Provenance Sketches for Data Skipping

Ziyu Liu, Boris GlavicarXiv 2025 · DOI

Introduction

Modern database management systems rely heavily on physical design artifacts, such as indexes and zone maps, to implement data skipping—a technique that avoids reading irrelevant data blocks to accelerate query processing. While effective for simple filters, these static methods often struggle with complex queries involving HAVING clauses or top-k constraints. In such cases, the system cannot easily determine which data fragments contribute to the final result through static analysis alone.

Provenance-Based Data Skipping (PBDS) offers a dynamic alternative by recording "provenance sketches"—metadata that tracks which horizontal fragments of a table contain data contributing to a query's output. However, the utility of a provenance sketch is highly sensitive to the attribute used for table partitioning.

The Challenge of Sketch Selection

The effectiveness of a provenance sketch depends on the "alignment" between the partitioning attribute and the query's provenance. If the relevant data is clustered within a few ranges of an attribute, the resulting sketch will be sparse (highly selective), allowing the system to skip the majority of the table. Conversely, if the provenance is scattered across all ranges, the sketch provides little to no benefit.

Example of a data table and its corresponding provenance sketches for different partitioning attributes.

As shown in the figure above, different attributes ($pid, month, year$) result in sketches of varying densities for the same set of groups ($g_0$ to $g_5$). Building every possible sketch to find the optimal one is computationally prohibitive. Thus, there is a critical need for a fast, accurate method to estimate a sketch's selectivity before it is materialized.

The Cost-Based Selection Framework

The authors propose a framework that repurposes Approximate Query Processing (AQP) as a meta-tool for physical design. Instead of building full sketches, the system estimates their size using a sample-based approach.

The proposed system architecture for cost-based selection of provenance sketches.

The core components of this framework include:

  • Stratified Reservoir Sampling: To ensure that queries with many groups (common in GROUP BY operations) are accurately represented, the system employs stratified sampling. This ensures that even small, highly selective groups are captured in the sample, preventing estimation errors due to missing data.
  • Bootstrap Resampling: The system performs multiple rounds of resampling from the initial sample to generate robust statistics and confidence intervals. This helps the model account for data skew and provides a measure of certainty for its estimates.
  • Cost-Based Selection Strategies: The primary strategy, CB-OPT-GB, prunes candidate attributes to those present in the GROUP BY clause. It then uses the AQP model to select the attribute predicted to yield the smallest (most selective) sketch.
  • Safety Filtering: A static safety test is applied initially to ensure that a sketch built on a specific attribute will not lead to incorrect query results, filtering out invalid candidates before estimation begins.

Experimental Evaluation

The framework was evaluated using four diverse datasets: Chicago Crime (geographical correlations), TPC-H (industry benchmark), NYC Parking (large-scale violations), and SDSS-V (astronomical data).

Key findings include:

  • High Estimation Accuracy: The cost model identified the optimal sketch attribute in nearly 100% of cases for the Crime and Parking datasets. For TPC-H, it achieved 85% accuracy for the top choice and nearly 100% when considering the top three candidates.
  • Performance Gains: Implementing cost-based selection resulted in query runtime improvements of up to 60% compared to random selection or no data skipping.
  • Minimal Overhead: The sampling and estimation process is a one-time cost. Once an optimal sketch is created, subsequent queries benefit immediately, making the overhead negligible over the long term.

Conclusion

By treating physical design as an estimation problem solvable via AQP, this work provides a robust method for optimizing provenance-based data skipping. The proposed framework accurately predicts the most effective partitioning attributes, significantly reducing query latency in complex analytical workloads. Future work will explore the impact of attribute correlations and the challenges of maintaining sketches in dynamic environments with frequent data updates.

Summary updated

BibTeX
@misc{liu2025cost,
  author = {Ziyu Liu and Boris Glavic},
  title = {{Cost-based Selection of Provenance Sketches for Data Skipping}},
  year = {2025},
  eprint = {2504.19252},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.19252},
}
Figure