Introduction
Materialized views (MVs) are a cornerstone of database performance, providing pre-computed results for complex analytical queries. However, in high-velocity data environments, these views quickly become stale. Database administrators typically face a binary choice: eager maintenance, which ensures freshness but bottlenecks transaction throughput, or deferred maintenance, which preserves performance but leaves users with inaccurate, stale results.
This paper proposes Stale View Cleaning (SVC), a middle-ground approach that treats view staleness as a data cleaning problem. Instead of performing a full, costly update of the entire view, SVC maintains a statistically sound, up-to-date sample to provide mathematically bounded estimates for aggregate queries.
System Architecture
SVC operates by maintaining a small, "clean" sample of the materialized view. The high-level architecture involves taking a sample from the stale MV and applying updates only to that subset.
As shown in Figure 1, the system utilizes a Stale Sample MV which is transformed into an Up-to-date Sample MV through efficient data cleaning. To handle the high variance often introduced by skewed data distributions, SVC also maintains an Outlier Index. This index tracks extreme values in the base tables and ensures they are included in the sample, preventing them from distorting the final query result estimate.
Methodology: Hash Push-Down and Estimation
A core technical challenge in SVC is generating a representative sample without materializing the entire fresh view first. The authors solve this using Hash Push-Down for Efficient Sampling.
By using a deterministic hashing function on primary keys, the system can act as a uniform random sampler. As illustrated in Figure 3, the sampling operator ($\eta$) is pushed down the relational algebra tree. This allows the system to sample base tables (like LogIns and Video) before expensive joins and aggregations occur, significantly reducing the computational overhead of generating the "Delta View."
Once a clean sample is obtained, SVC offers two primary estimation strategies:
- SVC+AQP (Approximate Query Processing): The query is executed on the clean sample and the results are scaled up.
- SVC+CORR (Correction): This more advanced method runs the query on both the stale and clean samples to calculate a "correction factor." This delta is then applied to the exact answer derived from the full stale view. Because stale and fresh views are typically highly correlated, this method yields much lower variance than standard sampling.
Experimental Results
The authors evaluated SVC using both synthetic benchmarks (TPC-D Skew) and real-world industrial data (1TB Conviva activity logs).
- Efficiency: Maintaining a 10% sample via SVC was up to 10.1x faster than full Incremental View Maintenance (IVM). On a 10-node Apache Spark cluster, SVC achieved an average 7.5x speedup.
- Accuracy: The
SVC+CORRmethod proved highly effective, delivering results 11.7x more accurate than the stale baseline and 3.1x more accurate than standard AQP. On the 1TB dataset, the average query error was a remarkably low 0.98%. - Robustness: The outlier index successfully mitigated the impact of Zipfian data distributions, halving the 75th-percentile error on skewed datasets with minimal maintenance overhead.
Conclusion
Stale View Cleaning demonstrates that we do not need to choose between perfect freshness and high performance. By reframing staleness as a cleaning task and leveraging hash-based sampling push-down, SVC provides a scalable solution for modern data warehouses. Future work includes extending these techniques to support TOP-K queries and optimizing sampling across environments with multiple interdependent materialized views.
Summary updated