Skip to main content

Supported queries

Incremental SQL maintains a query over keyed (primary-key) sources. The shapes below are maintained incrementally; a shape outside the list falls back to a full recompute. An insert-only append-only source is also rejected for incremental maintenance but can run through Tier-2 full recompute; a delete-bearing append-only source is not maintained.

Projection, filter, distinct​

ShapeNotes
SELECT [expr AS c, ...] FROM src [WHERE p]The filter may compare against an uncorrelated scalar subquery
SELECT DISTINCT c, ... FROM srcMaintains one row per distinct tuple
SELECT DISTINCT ON (g) g, v FROM src [ORDER BY ...]The source primary key breaks ties deterministically

Aggregates​

ShapeNotes
SUM, COUNT(*), COUNT(v), AVGWith or without GROUP BY; HAVING supported
MIN, MAXWith or without GROUP BY
COUNT(DISTINCT v), SUM(DISTINCT v)Multi-column distinct requires a GROUP BY
VAR_SAMP, VAR_POP, STDDEV_SAMP, STDDEV_POP, STDDEV
MEDIAN
BOOL_AND, BOOL_OR
APPROX_DISTINCT, APPROX_PERCENTILE_CONT, APPROX_MEDIANApproximate results
STRING_AGG, ARRAY_AGGORDER BY inside the aggregate is supported
BIT_AND, BIT_OR, BIT_XOR
CORR, COVAR_SAMP, COVAR_POP, REGR_*
PERCENTILE_CONT
Mixed aggregates in one GROUP BYAny mix of the supported functions

GROUPING SETS, ROLLUP and CUBE are expanded to their member sets. SUM, COUNT and AVG keep the incremental layout; other mixes are recomputed per set.

Windows and top-k​

ShapeNotes
ROW_NUMBER() OVER (PARTITION BY p ORDER BY o)Maintained by recomputing the affected partitions
SELECT ... FROM (SELECT ..., ROW_NUMBER() ... AS rn) t WHERE rn <= kTop-k per partition
SELECT ... FROM src ORDER BY o LIMIT kGlobal top-k; OFFSET shifts the window

Ties at the boundary are broken by the source primary keys.

Joins​

ShapeNotes
Inner equi-joinBoth sides keyed; keys may have different names; multiple payload columns
LEFT JOIN with a right side keyed by the join keysLookup join
Multi-way inner joins (3–32 sources)Optional side filters and cross-source conditions
Left-deep [LEFT] JOIN chainsEach step keyed by its join keys
CROSS JOINBoth sides keyed
LEFT, RIGHT, FULL outer equi-joinsUnmatched identities are nullable
IS NOT DISTINCT FROM join keysMatches NULL with NULL for plain columns

Set operations​

ShapeNotes
UNION ALLMerges sources with the same schema
UNIONDeduplicated
INTERSECT, EXCEPTBoth DISTINCT and ALL variants
INTERSECT ALL, EXCEPT ALLPer-tuple match counts

Semi/anti and correlated shapes​

ShapeNotes
[NOT] EXISTS, IN, op ANY, op ALLSemi/anti joins, optional side filters
Correlated scalar aggregate in the select listCOUNT family keeps empty-set semantics
Correlated scalar filter (WHERE v > (SELECT AVG(v) ...))The subquery tables are watched alongside the source

Unsupported​

  • Append-only sources for incremental runs. Use a keyed source, or let the shape fall back to a full recompute.
  • A SELECT that changes the target's row identity without a primary key on the target.
  • A shape outside the list above. The engine reports unsupported incremental view shape and does not write a partial result.

Next​