This page summarizes supported features, limitations, and best practices.
Feature Supported Notes SELECT, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT Yes Column aliases (AS) Yes Expressions (CASE, CAST, LIKE, BETWEEN, IN, arithmetic) Yes Full expression support EXPLAIN Yes Returns execution plan as text or JSON 173 scalar functions Yes Math, string, datetime, regex, crypto, array, map, struct, JSON 33 aggregate functions Yes Basic, approximate, statistical, bitwise, boolean, positional Approximate aggregates Yes approx_distinct, approx_median, approx_percentile_cont, approx_top_kStruct / Array / Map column types Yes Bracket notation, get_field(), array functions, map functions CTEs (WITH ... AS) Yes Single-table only. No JOINs or cross-table references within CTEs. JOINs No Single-table only Subqueries No Window functions (OVER) No SELECT DISTINCTNo Use approx_distinct OFFSETNo UNION / INTERSECT / EXCEPTNo INSERT / UPDATE / DELETENo Read-only CREATE / DROP / ALTERNo Read-only
For the full SQL syntax, refer to the SQL reference .
Feature Error JOINs (any type) unsupported feature: JOIN operations are not supportedMulti-table CTEs (JOINs or cross-table references within WITH) Single-table CTEs are supported Subqueries (FROM, WHERE, scalar) unsupported feature: subqueriesSELECT DISTINCTunsupported feature: SELECT DISTINCT is not supportedOFFSETunsupported feature: OFFSET clause is not supportedUNION / INTERSECT / EXCEPTSet operations not supported Window functions (OVER) unsupported feature: window functions (OVER clause)INSERT / UPDATE / DELETEonly read-only queries are allowedCREATE / DROP / ALTERonly read-only queries are allowedUNNEST / PIVOT / UNPIVOTNot supported Wildcard modifiers (ILIKE, EXCLUDE, EXCEPT, REPLACE, RENAME on *) Not supported LATERAL VIEW / QUALIFYNot supported
Unsupported expression patterns
Pattern Alternative func(DISTINCT ...) on any aggregateUse approx_distinct for counting PERCENTILE_CONT / PERCENTILE_DISCUse approx_percentile_cont MEDIANUse approx_median ARRAY_AGGNo alternative (unsupported for memory safety) STRING_AGGNo alternative (unsupported for memory safety) Scalar subqueries (SELECT ... WHERE x = (SELECT ...)) Not supported EXISTS (SELECT ...)Not supported IN (SELECT ...)Use IN (value1, value2, ...) with a literal list
Constraint Details Single table per query Queries must reference exactly one table. No JOINs, no subqueries. CTEs may reference a single table. Partitioned and unpartitioned tables Both partitioned and unpartitioned Iceberg tables are supported. Parquet format only No CSV, JSON, or other formats. Read-only R2 SQL is a query engine, not a database. No writes. now() / current_time() precisionQuantized to 10ms boundaries and forced to UTC.
Code Meaning 40003 Invalid SQL syntax 40004 Invalid query (unsupported feature, unknown column, type mismatch) 80001 Edge service connection failure (retry)
Include time-range filters in WHERE to limit data scanned.
Use specific column names instead of SELECT * for better performance.
Use LIMIT to control result set size.
Use approximate aggregation functions (approx_distinct, approx_median, approx_percentile_cont) instead of exact alternatives on large datasets.
Enable compaction in R2 Data Catalog to reduce the number of files scanned per query.
Use EXPLAIN to inspect the execution plan and verify predicate pushdown.