---
title: "Approximate answers, exact decisions: New sketch functions for analytics"
description: "Databricks now supports four sketch function families, built on Apache DataSketches, for replacing expensive exact percentiles, distinct counts, set operations, top-K rankings, and metric aggregations with bounded-memory approximations. KLL sketches answer quantiles, Theta sketches support unions, intersections, and differences, approximate top-K sketches track frequent items, and Tuple sketches combine distinct counting with aggregated metrics such as customer revenue. The sketches can be built during ETL, stored as columns in Delta tables, and merged on read, allowing dashboards and streaming pipelines to avoid rescanning raw data; SQL, DataFrame, and Structured Streaming pipelines are supported. The stated trade-off is configurable 1–2% relative error, with the source citing a 1000x speedup for applicable workloads. Exact methods remain appropriate for financial auditing, compliance reporting, and other precision-required uses."
---

# Approximate answers, exact decisions: New sketch functions for analytics

[Databricks](https://yomu.fyi/company/databricks) · Daniel Tenedorio, Kent Marten, Gengliang Wang, Chenhao Li · Apr 29, 2026

**Type:** Announcement

## Summary

Databricks now supports four sketch function families, built on Apache DataSketches, for replacing expensive exact percentiles, distinct counts, set operations, top-K rankings, and metric aggregations with bounded-memory approximations. KLL sketches answer quantiles, Theta sketches support unions, intersections, and differences, approximate top-K sketches track frequent items, and Tuple sketches combine distinct counting with aggregated metrics such as customer revenue. The sketches can be built during ETL, stored as columns in Delta tables, and merged on read, allowing dashboards and streaming pipelines to avoid rescanning raw data; SQL, DataFrame, and Structured Streaming pipelines are supported. The stated trade-off is configurable 1–2% relative error, with the source citing a 1000x speedup for applicable workloads. Exact methods remain appropriate for financial auditing, compliance reporting, and other precision-required uses.

## Context

Analytical workloads such as percentile queries, distinct counts, set operations, and top-K rankings can require global sorts, large-memory deduplication, cluster shuffles, or repeated scans of billions of raw records. The post positions approximate answers as suitable when a 1–2% relative error does not change a decision, while identifying financial auditing, compliance reporting, and other precision-required uses as cases for exact methods.

## Approach / What changed

The change adds four Apache DataSketches-based function families: KLL quantile sketches, Theta sketches for set algebra, approximate top-K sketches, and Tuple sketches for distinct values with aggregated metrics. Sketches can be built during ETL or streaming, stored in Delta tables, merged across partitions or time windows, and queried through SQL, DataFrame, and Structured Streaming pipelines.

## Takeaways

- KLL sketches provide configurable 1–2% relative-error quantiles and can return multiple values such as P50, P90, and P99 from one stored sketch.
- Theta sketches support unions, intersections, and differences on distinct-value sets, enabling campaign reach and overlap analysis without shuffling raw user IDs.
- Tuple sketches associate each distinct customer with an aggregated metric, allowing customer counts and revenue sums to be merged without double-counting across periods.

**Tags:** [Delta Lake](https://yomu.fyi/topic/delta-lake), [Spark](https://yomu.fyi/topic/spark), [Streaming](https://yomu.fyi/topic/streaming)

- Source: [Databricks](https://www.databricks.com/blog/approximate-answers-exact-decisions-new-sketch-functions-analytics)
- Source URL: https://www.databricks.com/blog/approximate-answers-exact-decisions-new-sketch-functions-analytics
- Ingested by Yomu: 2026-08-31T03:40:28.531Z

[Read original post](https://www.databricks.com/blog/approximate-answers-exact-decisions-new-sketch-functions-analytics)
