R2 SQL - R2 SQL now supports window functions, DISTINCT, and set operations
13d ago
Source
CloudflareR2 SQL - R2 SQL now supports window functions, DISTINCT, and set operationscloudflare.comR2 SQL now supports window functions, SELECT DISTINCT , set operations, and additional aggregates, making it easier to write analytical queries without preprocessing your data elsewhere. R2 SQL is Cloudflare's serverless, distributed SQL engine for querying Apache Iceberg tables stored in R2 Data Catalog . New capabilities Window functions — ROW_NUMBER , RANK , DENSE_RANK , PERCENT_RANK , CUME_DIST , NTILE , LAG , LEAD , FIRST_VALUE , LAST_VALUE , NTH_VALUE , and aggregates with an OVER (...) clause, including PARTITION BY and explicit frames QUALIFY — filter rows based on a window function result DISTINCT — SELECT DISTINCT , DISTINCT ON (...) , and the DISTINCT modifier on aggregates such as COUNT(DISTINCT ...) Set operations — UNION , UNION ALL , INTERSECT , and EXCEPT Grouping extensions — GROUPING SETS , ROLLUP , and CUBE Exact aggregates — MEDIAN , PERCENTILE_CONT , ARRAY_AGG , and STRING_AGG Examples Rank rows with a window function SELECT customer_id, region, ROW_NUMBER () OVER ( PARTITION BY region ORDER BY total_amount DESC ) AS rank_in_region FROM my_namespace.sales_data Filter with QUALIFY SELECT customer_id, region, total_amount FROM my_namespace.sales_data QUALIFY ROW_NUMBER () OVER ( PARTITION BY region ORDER BY total_amount DESC ) <= 3 Combine tables with a set operation SELECT customer_id FROM my_namespace.sales_data EXCEPT SELECT customer_id FROM my_namespace.archived_sales The named WINDOW clause is not supported — inline the OVER (...) specification at each call site. For the full syntax reference, refer to the SQL reference . For supported features and performance guidance, refer to Limitations and best practices .
You might also wanna read
Version 18.2
Microsoft·1mo ago
Technical Discussion: Distributed SQL Engine Requirements for Ultra-Wide Tables in ML and Multi-Omics Data
A technical discussion about the limitations of current SQL databases and data processing systems when handling ultra-wide tables with thous
Optimizing Geospatial SQL Queries with H3 Indexes for 400× Performance Gains
The article explains how to dramatically speed up geospatial SQL queries (geo joins) using H3 indexes. It describes the performance problems
ClickHouse AggregatingMergeTree: Accelerating Analytics with Pre-Aggregated Data
This article explains ClickHouse's AggregatingMergeTree engine, which pre-aggregates data to speed up analytical queries on large datasets.
dev.to·1d agoggsql: Grammar of Graphics Implementation for SQL Visualization
ggsql is a new tool that implements the grammar of graphics (like ggplot2) using SQL syntax, allowing users to create data visualizations di
Cloudflare Launches Fully-Managed Data Platform for Analytical Data on Global Infrastructure
Cloudflare announced the Cloudflare Data Platform, a fully-managed suite of products for ingesting, storing, and querying analytical data. B

Comments
Sign in to join the conversation.
No comments yet. Be the first.