GUIDE
Streaming SQL extends standard SQL to process continuous data streams. Learn how to write streaming queries, create materialized views, handle time windows, and build real-time pipelines — all using PostgreSQL-compatible SQL in RisingWave.
Core Concept
Streaming SQL applies the declarative power of SQL to continuous, unbounded data streams. Standard SQL operates on finite tables — you run a query, get a result, and the query terminates. Streaming SQL runs queries that never terminate: they process each incoming event and continuously update their results as new data arrives.
| Dimension | Standard SQL | Streaming SQL |
|---|---|---|
| Execution | Runs once, returns result | Runs forever, updates continuously |
| Data Model | Finite table (bounded) | Continuous stream (unbounded) |
| Result | Snapshot at query time | Always-current materialized view |
| Freshness | Stale until re-queried | Sub-second, event-driven |
Capabilities
RisingWave supports the full range of PostgreSQL-compatible SQL constructs for streaming: SELECT, JOIN (inner, left, right, full), GROUP BY, HAVING, window functions (ROW_NUMBER, RANK, LAG, LEAD), subqueries, CTEs, CASE expressions, and aggregate functions (COUNT, SUM, AVG, MIN, MAX). All of these work continuously over streams.
Join two or more streams in real-time. RisingWave handles temporal alignment, state management, and output updates across all join types.
COUNT, SUM, AVG, MIN, MAX, and custom aggregations run incrementally. Results update in milliseconds as new events arrive.
ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, FIRST_VALUE, LAST_VALUE — all work over streaming data with partition and order clauses.
Nest queries and use WITH clauses for readable, composable streaming logic. Common table expressions simplify complex pipelines.
Time & Windows
Streaming SQL introduces time-based windowing to partition unbounded streams into finite, processable chunks. RisingWave supports tumbling windows (fixed, non-overlapping intervals), hopping windows (fixed, overlapping intervals), and session windows (gap-based grouping) — all expressed in standard SQL syntax with event-time semantics.
Start building real-time streaming pipelines with PostgreSQL-compatible SQL.
Start Writing Streaming SQL