R2 SQL adds JSON functions, EXPLAIN FORMAT JSON, and unpartitioned table support
Key Points
- JSON functions for in-SQL JSON extraction
- EXPLAIN FORMAT JSON emits structured plans
- Query unpartitioned Iceberg tables (partition if >1000 files)
Summary
Cloudflare R2 SQL adds three practical features: SQL-level JSON functions for extracting and manipulating JSON stored in Apache Iceberg tables in R2 Data Catalog, an EXPLAIN FORMAT JSON mode that returns execution plans as structured JSON for programmatic analysis and observability, and support for querying unpartitioned Iceberg tables (useful for small or non-time-based datasets).
Key Points
- JSON functions: new built-in functions like
json_get_str,json_get_int,json_get_bool, andjson_containslet you extract and test JSON values directly in queries without client-side parsing. Example:SELECT json_get_str(doc, 'name') AS name FROM my_namespace.sales_data WHERE json_contains(doc, 'email'). - EXPLAIN FORMAT JSON: returns the query execution plan as structured JSON (machine-readable) so you can integrate plan output into observability tools or automated analysis. Example:
EXPLAIN FORMAT JSON SELECT * FROM logpush.requests LIMIT 10;. - Unpartitioned table support: R2 SQL can query Iceberg tables that have no partition keys—handy for smaller datasets. For tables with more than ~1000 files, continue to prefer partitioning for performance.
Notes
- Check the R2 SQL docs for the full list of JSON functions and EXPLAIN details before production use.
- Use partitioning as a scalability optimization when table file counts grow beyond recommended thresholds.