Skip to main content

Module incremental_view

Module incremental_view 

Source
Expand description

CREATE INCREMENTAL VIEW and DECLARE RECURSIVE VIEW SQL extensions.

Supported DDL:

-- Non-recursive incremental view (IVM)
CREATE INCREMENTAL VIEW revenue AS
  SELECT customer_id, SUM(amount) AS total FROM orders GROUP BY customer_id
  LATENESS event_ts INTERVAL '5' MINUTE;

-- Materialized variant (keeps a full snapshot in memory)
CREATE MATERIALIZED INCREMENTAL VIEW revenue AS ...;

-- Recursive view (fixed-point iteration, auto-DISTINCT)
DECLARE RECURSIVE VIEW reachable AS
  SELECT dst FROM edges WHERE src = 0
  UNION ALL
  SELECT e.dst FROM edges e JOIN reachable r ON e.src = r.dst;

-- Force a re-step (no-op for streaming; useful in batch/test mode)
REFRESH INCREMENTAL VIEW revenue;

-- Remove view and its cached Trace state
DROP INCREMENTAL VIEW revenue;

Structs§

IncrementalViewEntry
Metadata stored for one registered incremental view.
IncrementalViewRegistry
Registry of active incremental views (SQL metadata layer).
LatenessAnnotation
One LATENESS annotation: LATENESS <column> INTERVAL '<n>' <unit>.

Enums§

IncrementalViewStatement
Parsed incremental-view DDL statement.

Functions§

execute_incremental_view_ddl
Apply a parsed incremental-view DDL statement to the registry.
parse_incremental_view_statement
Parse incremental-view DDL statements from a SQL string.