CCloud Releases
Home
Following

Cloud Releases

Service catalogues and updates come from each provider's public product listing and announcements.

Explore

  • Home
  • Latest updates
  • Following

About

  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Providers

  • Amazon Web Services
  • Microsoft Azure
  • Google Cloud
  • Cloudflare

Not affiliated with any cloud provider. Product names and logos belong to their owners.

  1. Providers
  2. ›Cloudflare
  3. ›Basin SQL
  4. ›Update

Feature•Feb 9, 2026

R2 SQL now supports approximate aggregation functions

Basin SQLCloudflare · Developer platform

R2 SQL now supports five approximate aggregation functions for fast analysis of large datasets. These functions trade minor precision for improved performance on high-cardinality data.

New functions

  • APPROX_PERCENTILE_CONT(column, percentile) — Returns the approximate value at a given percentile (0.0 to 1.0). Works on integer and decimal columns.
  • APPROX_PERCENTILE_CONT_WITH_WEIGHT(column, weight, percentile) — Weighted percentile calculation where each row contributes proportionally to its weight column value.
  • APPROX_MEDIAN(column) — Returns the approximate median. Equivalent to APPROX_PERCENTILE_CONT(column, 0.5).
  • APPROX_DISTINCT(column) — Returns the approximate number of distinct values. Works on any column type.
  • APPROX_TOP_K(column, k) — Returns the k most frequent values with their counts as a JSON array.

All functions support WHERE filters. All except APPROX_TOP_K support GROUP BY.

Examples

-- Percentile analysis on revenue data SELECT approx_percentile_cont(total_amount, 0.25), approx_percentile_cont(total_amount, 0.5), approx_percentile_cont(total_amount, 0.75) FROM my_namespace.sales_data

-- Median per department SELECT department, approx_median(total_amount) FROM my_namespace.sales_data GROUP BY department

-- Approximate distinct customers by region SELECT region, approx_distinct(customer_id) FROM my_namespace.sales_data GROUP BY region

-- Top 5 most frequent departments SELECT approx_top_k(department, 5) FROM my_namespace.sales_data

-- Combine approximate and standard aggregations SELECT COUNT(*), AVG(total_amount), approx_percentile_cont(total_amount, 0.5), approx_distinct(customer_id) FROM my_namespace.sales_data WHERE region = 'North'

For the full syntax and additional examples, refer to the SQL reference.

Read the original announcement↗

More from Basin SQL

All Basin SQL updates →
  1. Cloudflare Basin is now generally available

    Basin, formerly the Cloudflare Data Platform, is now generally available. Basin brings an end-to-end analytics platform to the Developer Platform, enabling you to collect data from a variety of sources, such as apps, infrastructure, devices, and other Cloudflare services, then…

    Basin SQL•Generally available•Oct 1, 2026
  2. Billing is now enabled for R2 SQL

    Billing is now enabled for R2 SQL on non-enterprise accounts. R2 SQL usage beyond the included free tier will appear on your next invoice.

    Basin SQL•Feature•Aug 3, 2026
  3. Query R2 Data Catalog tables with R2 SQL from the dashboard

    You can now query your R2 Data Catalog tables with R2 SQL directly from the Cloudflare dashboard, without installing a CLI or wiring up a client. This makes it easy to explore your Apache Iceberg data, validate queries, and inspect results in one place.

    Basin SQL•Feature•Jul 8, 2026
  4. R2 SQL now supports window functions, DISTINCT, and set operations

    R2 SQL now supports window functions, SELECT DISTINCT, set operations, and additional aggregates, making it easier to write analytical queries without preprocessing your data elsewhere.

    Basin SQL•Feature•Jun 22, 2026
  5. R2 SQL now supports UNION, INTERSECT, EXCEPT, and SELECT DISTINCT

    R2 SQL now supports set operations ( UNION, INTERSECT, EXCEPT ) and SELECT DISTINCT, expanding the range of analytical queries you can run directly on Apache Iceberg tables in R2 Data Catalog.

    Basin SQL•Feature•Jun 8, 2026