BlinkDB: queries with bounded errors and bounded response times on very large data

Sameer Agarwal, Barzan Mozafari, Aurojit Panda, Henry Milner, Samuel Madden, Ion Stoica · DOI

TL;DR

BlinkDB is a novel approximate query engine designed for interactive analysis of massive datasets. It allows users to specify desired accuracy or response time constraints, enabling queries to run orders of magnitude faster by querying pre-computed data samples instead of the entire dataset.

What Problem Does This Paper Address?

Modern data analytics applications, like those in search engines or financial trading, demand near real-time responses to queries on massive datasets (terabytes or more). Traditional approaches involve full data scans, which are too slow for interactive use, often taking minutes to hours. Users resort to ad-hoc methods like sampling small data slices, which can lead to inaccurate or incomplete results. The core challenge is to provide fast, interactive query responses on large datasets while still offering meaningful accuracy guarantees.

Methods

BlinkDB tackles this by introducing two key innovations:

  • Adaptive Multi-Dimensional, Multi-Resolution Sampling: Instead of simple random samples, BlinkDB builds and maintains a sophisticated set of samples. These include:
  • Multi-dimensional samples: Stratified samples that are biased towards specific combinations of columns, chosen based on historical query patterns and data skew. This is formulated as an optimization problem to select the most beneficial column combinations within a given storage budget.
  • Multi-resolution samples: For each set of dimensions, BlinkDB maintains samples of progressively larger sizes. This allows for finer-grained trade-offs between accuracy and response time.
  • Dynamic Sample Selection: At query time, BlinkDB doesn't just pick a single sample. It uses a dynamic strategy to:
  • Estimate query selectivity and complexity by "probing" smaller samples.
  • Extrapolate these estimates to determine the optimal sample size (resolution) from a chosen sample family (dimensions) that meets the user's specified error or response time constraints.
  • It also handles query constraints by creating an Error-Latency Profile (ELP) for each query.

Datasets

  • TPC-H Benchmark: A standard benchmark for evaluating database systems, used here with a scale factor of 1000 (1 TB of data).
  • Conviva Inc. Real-world Workload: A dataset representing internet user video stream access logs. The paper uses a 17 TB version of this data, derived from 1.7 TB of raw logs spanning 30 days. This dataset consists of a large fact table with 104 columns and approximately 5.5 billion rows.

Key Insights and Ideas

  • The Power of Stratified Multi-Dimensional Samples: Simple random sampling is insufficient for skewed data. Stratified samples, especially those considering combinations of frequently queried and skewed columns, significantly improve query accuracy and convergence speed.
  • Optimization for Sample Selection: Deciding which samples to build is crucial. BlinkDB formulates this as an optimization problem, balancing data skew, workload characteristics (query templates), and storage costs.
  • Runtime Adaptability is Key: Pre-computing samples is efficient, but selecting the right sample at query time based on specific constraints (error/time) is what makes interactive analysis feasible. Probing smaller samples to estimate performance is a clever way to achieve this without running the full query.
  • Trade-offs are Explicit and Controlled: BlinkDB formalizes the accuracy-time trade-off, allowing users to explicitly state their requirements and receive results with quantifiable error bounds.

Key Results

  • Massive Speedups: BlinkDB can answer queries on up to 17 TB of data in less than 2 seconds, achieving over 100x (and up to 200x) faster response times compared to Hive.
  • High Accuracy: Queries are answered with an error of 2-10% at 95% confidence.
  • Improved Convergence: Multi-dimensional stratified samples converge to accurate results orders of magnitude faster than random or single-dimensional stratified samples.
  • Efficient Storage: Even for heavily skewed data (Zipfian distribution), the storage overhead for maintaining stratified samples is relatively low (e.g., 2.4% to 11.4% of original table size for common scenarios).
  • Meeting Constraints: BlinkDB effectively meets user-specified response time and error bounds.

Limitations and Future Work

  • Join Support: BlinkDB currently supports joins where at least one of the join tables is either sampled or fits in memory. More complex join scenarios might be challenging.
  • Closed-Form Aggregates: The current error estimation relies on closed-form aggregates (COUNT, SUM, MEAN, MEDIAN/QUANTILE). While extensible to other algebraic functions, it's not universally applicable to all possible UDFs.
  • Sample Maintenance Overhead: While optimized, maintaining samples involves background tasks that could potentially impact cluster performance, though the paper emphasizes minimizing this impact.
  • Future Work: The paper suggests exploring more sophisticated sample selection strategies, handling more complex query types, and further optimizing sample maintenance. The system is open-source, inviting community contributions.

Summary updated

BibTeX
@inproceedings{agarwal2013blinkdb,
  author = {Sameer Agarwal and Barzan Mozafari and Aurojit Panda and Henry Milner and Samuel Madden and Ion Stoica},
  title = {{BlinkDB: queries with bounded errors and bounded response times on very large data}},
  booktitle = {EuroSys},
  year = {2013},
  doi = {10.1145/2465351.2465355},
}
Figure