Expand description
Channel type derivation from query plan analysis.
This module analyzes query plans to automatically determine whether sources need SPSC (single consumer) or broadcast (multiple consumer) channels.
§Key Principle
Users never specify broadcast mode. The planner analyzes MVs and sources to derive the correct channel type automatically:
- If a source is consumed by exactly 1 MV → SPSC (optimal)
- If a source is consumed by 2+ MVs → Broadcast
§Example
CREATE SOURCE trades (...);
CREATE MATERIALIZED VIEW vwap AS
SELECT symbol, SUM(price * volume) / SUM(volume) AS vwap
FROM trades
GROUP BY symbol, TUMBLE(ts, INTERVAL '1' MINUTE);
CREATE MATERIALIZED VIEW max_price AS
SELECT symbol, MAX(price)
FROM trades
GROUP BY symbol, TUMBLE(ts, INTERVAL '1' MINUTE);In this example, trades source has 2 consumers (vwap and max_price),
so the planner derives Broadcast { consumer_count: 2 } for trades.
Structs§
- Channel
Derivation Result - Channel derivation result with additional metadata.
- MvDefinition
- Materialized view definition for channel derivation.
- Source
Definition - Source definition for channel derivation.
Enums§
- Derived
Channel Type - Channel type derived from query analysis.
Functions§
- analyze_
mv_ sources - Analyzes a single MV to extract its source references.
- derive_
channel_ types - Analyzes query plan to determine channel types per source.
- derive_
channel_ types_ detailed - Derives channel types with additional analysis metadata.