Overview of Cloudflare R2 SQL
mainR2 SQL is a serverless, distributed analytics query engine designed for querying Apache Iceberg tables stored in the Cloudflare R2 Data Catalog. It leverages Cloudflare's global network for parallel execution and features zero egress fees when querying data from any cloud or region.
Use Cases
- Log analytics: Querying application/system logs with filters and aggregations.
- BI dashboards: Generating reports from large analytical datasets.
- Fraud detection: Analyzing transaction patterns using
GROUP BYandHAVING. - Multi-cloud analytics: Querying data without incurring egress costs.
- Ad-hoc exploration: Running SQL queries via the Wrangler CLI.
When NOT to use R2 SQL
- Workers/Pages runtime: R2 SQL has no Workers binding; use the HTTP API from external systems instead.
- Real-time queries: It is optimized for analytical batch queries, not OLTP (<100ms).
- Complex joins/CTEs: The current SQL feature set does not support
JOINs, subqueries, or CTEs. - Small datasets: Setup overhead may not be justified for datasets smaller than 1GB.