R2 SQL Now Joins Your Tables: JOINs, Subqueries, and More!
Hey there, it's Shii-chan! Today I found news that R2 SQL just got a lot more powerful. It looks like it'll make data analysis so much smoother, and I'm excited.
Cloudflare ChangelogWhat was announced?
On the Cloudflare Changelog, they announced that R2 SQL now supports JOINs, subqueries, and multi-table queries (May 15, 2026). R2 SQL is a serverless, distributed SQL engine for querying Apache Iceberg tables stored in R2 Data Catalog. It runs directly on Cloudflare's global network, so there's no infrastructure to manage, and you can analyze data in R2 without exporting it to an external warehouse.
The story so far
Until now, R2 SQL was mostly about querying a single table. But real analysis often needs you to combine tables — like joining a requests table with a zones table to aggregate across both. This update adds a whole bunch of ways to work across tables.
What changes
You can now join multiple Iceberg tables in a single query. Connect tables with JOINs, filter with subqueries, and build complex analytical queries with multi-table CTEs. The nice part is that multi-table analysis stays entirely inside R2 — no need to move data to an external warehouse.
Dive Deep
Here's what's now available:
- JOINs: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, plus implicit joins (comma-separated FROM with conditions in WHERE).
- Subqueries: IN / NOT IN, EXISTS / NOT EXISTS, scalar subqueries in SELECT / WHERE / HAVING, and derived tables (subqueries in FROM).
- Multi-table CTEs: WITH clauses can reference different tables and include JOINs.
- Self-joins: join a table with itself using different aliases.
- Multi-way joins: join three or more tables in a single query.
For example, here's a two-table INNER JOIN with aggregation:
SELECT z.domain, z.plan, COUNT(*) AS request_count
FROM my_namespace.zones z
INNER JOIN my_namespace.http_requests h ON z.zone_id = h.zone_id
WHERE z.plan = 'enterprise'
GROUP BY z.domain, z.plan
ORDER BY request_count DESC
LIMIT 20
For the full syntax, check the SQL reference, and for performance tips when using joins, see Limitations and best practices.
Wrap-up
- R2 SQL now supports JOINs, subqueries, and multi-table queries.
- JOINs cover INNER / LEFT / RIGHT / FULL OUTER / CROSS plus implicit, self, and multi-way joins.
- Subqueries include IN / EXISTS / scalar / derived tables, and CTEs can span multiple tables.
- Multi-table analysis stays entirely inside R2, with no export to an external warehouse.
If you're storing data in R2 Data Catalog and want to dig deeper into it, this update is a great fit for you.