CloudflareJérôme Schneider
Announcing support for GROUP BY, SUM, and other aggregation queries in R2 SQL
Cloudflare has announced support for GROUP BY, SUM and other aggregation queries in R2 SQL, enabling SQL analyses over data stored in R2 Data Catalog. The post explains how aggregations provide a bird’s-eye summary and can be used to generate reports, with examples such as selecting department and sum(value) from sales grouped by department, and further filtering with ORDER BY and HAVING clauses.
It describes two aggregation approaches—compute sooner or later—highlighting pre-aggregates and the need to split queries into phases when aggregates are referenced in HAVING or ORDER BY. A key shift is from scatter-gather to shuffling in which a deterministic hash partitioning stage colocates data by grouping key, followed by a streaming merge where the coordinator performs a k-way merge to deliver final results.
The update, dated 18 December 2025, emphasises that aggregations extend R2 SQL into a distributed analytics engine capable of processing massive datasets without moving data out of R2.