Bi-Level Online Aggregation on Raw Data

Weijie Zhao, Yu Cheng, Weijie Zhao 0001, Florin Rusu

TL;DR

OLA-RAW is a novel system that brings the speed of Online Aggregation (OLA) to in-situ data processing, allowing researchers to query massive raw files (like CSV or FITS) without the heavy upfront cost of database loading or data shuffling. By using a resource-aware, bi-level sampling scheme, it provides accurate query estimates up to 10x faster than traditional full-scan methods.

What Problem Does This Paper Address?

In the age of "data deluge," scientists and engineers often face a bottleneck: they have terabytes of raw data but don't know if it's worth the time to load it into a formal database for analysis. In-situ processing (querying files directly) offers a "zero-load" alternative, but it still requires expensive full scans and parsing for every query.

Online Aggregation (OLA) could solve this by providing early estimates with confidence bounds, allowing a user to stop a query once it's "accurate enough." However, traditional OLA requires the data to be randomly shuffled or sampled beforehand—a preprocessing step that can actually take longer than just loading the data into a database. OLA-RAW addresses this "catch-22" by performing sampling and estimation on-the-fly, directly over raw data, without any prior reorganization.

The OLA-RAW approach compared to traditional DBMS and OLA workflows.

Methods

The authors introduce several key technical innovations to make real-time sampling work:

  1. Bi-Level Sampling: Instead of just sampling chunks (which is fast but high-variance) or individual tuples (which is slow to extract from raw files), OLA-RAW does both. It reads random chunks and then adaptively extracts a subset of tuples from within those chunks.
  2. Solving the Inspection Paradox: In parallel systems, chunks that are faster to process (e.g., smaller or less complex) finish first. If you only use finished chunks for your estimate, you introduce bias. OLA-RAW uses a timing parameter ($t_{eval}$) to pull partial samples from all active processing threads at fixed intervals, ensuring the estimate remains unbiased.
  3. Resource-Aware Scheduling: The system monitors whether it is I/O-bound or CPU-bound. If the CPU is the bottleneck, it samples fewer tuples per chunk to keep the pipeline moving. If I/O is the bottleneck, it extracts more tuples from the chunks already in memory to improve accuracy without extra disk reads.
  4. Incremental Synopsis: OLA-RAW builds a memory-resident synopsis of the samples it has already extracted. This synopsis is maintained across a sequence of queries, using a variance-driven strategy to decide which data is most valuable to keep in a limited memory budget.
Comparison of sampling strategies: Exact, Chunk-level, and Bi-level.

Datasets

The system was evaluated using four large-scale datasets:

  • ptf-csv / ptf-fits: Real-world astronomy data from the Palomar Transient Factory (1 billion tuples, ~60-68 GB).
  • wiki: Wikipedia Traffic Statistics (1.8 billion tuples, 19 GB).
  • synthetic: A custom dataset designed to test various data distributions and skewness levels (134 million tuples, 20 GB).

Key Insights and Ideas

  • In-Situ OLA is a Balancing Act: The "sweet spot" for performance lies in balancing the cost of raw data extraction (CPU) with the cost of reading from disk (I/O). Static sampling rates fail because they can't adapt to these shifting bottlenecks.
  • Timing as a Synchronizer: By using a timer to trigger estimation rather than waiting for chunk completion, the system avoids the "step behavior" (long gaps with no updates) common in parallel OLA.
  • Variance-Driven Caching: Not all samples are created equal. By prioritizing the storage of samples from high-variance chunks in the memory synopsis, the system gets the most "accuracy bang for its buck" in subsequent queries.

Key Results

  • Speedup: OLA-RAW achieves the required accuracy (e.g., 95%) in as little as 10% of the time required by a full scan (external tables).
  • Efficiency: Compared to standard chunk-level sampling, OLA-RAW's bi-level approach significantly reduces the number of tuples that need to be parsed and converted, which is the primary bottleneck in raw data processing.
  • Adaptability: The resource-aware strategy successfully "morphs" between holistic and single-pass sampling depending on the hardware constraints, consistently outperforming static strategies.
  • Synopsis Benefit: A sample synopsis of less than 1% of the total data size provided a 10x reduction in execution time across a sequence of correlated queries.
How confidence bounds narrow over time as the estimate approaches the true result.

Limitations and Future Work

  • Chunk Size Sensitivity: Like all bi-level sampling methods, the performance of OLA-RAW is sensitive to the initial choice of chunk size. The authors suggest that dynamically adjusting chunk sizes at runtime is a promising area for future research.
  • Data Skew: While the system handles skew better than chunk-level sampling, extremely high data variability still requires processing a larger fraction of the data to reach high confidence.
  • Complex Joins: The current work focuses primarily on aggregate queries over a single large table (or star schemas). Extending this to complex many-to-many joins remains a challenge.

Summary updated

BibTeX
@inproceedings{zhao2017bi,
  author = {Weijie Zhao and Yu Cheng and Weijie Zhao and Florin Rusu},
  title = {{Bi-Level Online Aggregation on Raw Data}},
  booktitle = {Ssdbm},
  year = {2017},
  doi = {10.1145/3085504.3085514},
}
Figure