Databricks is rolling out a suite of new sketch functions, built on Apache DataSketches, designed to dramatically accelerate common analytical queries. These functions offer approximate answers to complex questions, enabling faster decision-making without the hefty compute costs associated with exact calculations.
The core benefit lies in transforming compute-intensive tasks like percentile calculations, distinct counts, and top-K rankings from minutes or hours into milliseconds. This is achieved by using bounded-memory approximations, typically with a configurable relative error of 1-2%, a trade-off deemed acceptable for many decision-support scenarios. This approach to approximate query processing significantly enhances data analytics performance optimization.
Faster Percentiles
Calculating percentiles on massive datasets often requires global sorting, a process that can consume substantial resources and time. Databricks' new KLL quantile sketches, however, can compute quantiles like P50, P90, and P99 over trillions of data points using constant memory. These sketches are also mergeable, allowing for incremental updates and quick retrieval of percentile data from pre-computed summaries stored in Delta tables.
Efficient Audience Overlap Analysis
Understanding audience overlap across different campaigns is crucial for marketing. Traditional methods involve complex set operations on potentially billions of user IDs, which is computationally prohibitive. Theta sketches, now supported by Databricks, summarize distinct value sets in compact, mergeable formats. They enable rapid unions, intersections, and set differences, making detailed audience analysis practical and cost-effective.
Real-Time Leaderboards and Aggregations
Identifying trending items or real-time leaderboards from high-cardinality event streams has historically been a batch-oriented problem. Approximate top-K sketch functions, however, can track the most frequent items in bounded memory. These sketches can be merged across time windows or partitions, allowing for instant aggregation and the creation of live leaderboards without reprocessing raw data.