Principle:Risingwavelabs Risingwave Batch Query Serving
| Knowledge Sources | |
|---|---|
| Domains | Query_Processing, Batch_Execution |
| Last Updated | 2026-02-09 07:00 GMT |
Overview
A query execution mechanism that serves ad-hoc SQL queries against pre-computed materialized view results using the PostgreSQL wire protocol.
Description
Batch Query Serving is the read path of a streaming database. While materialized views are continuously maintained by the streaming engine, users query their results using standard SQL SELECT statements through the PostgreSQL wire protocol (pgwire). This means any PostgreSQL-compatible client (psql, JDBC, Python psycopg2, etc.) can connect and query RisingWave.
The batch query engine optimizes and executes queries against the stored materialized view data. For simple point lookups, the query can be served directly from the storage layer. For complex queries involving joins or aggregations over materialized views, the batch engine constructs and executes a distributed query plan.
RisingWave supports both local and distributed query execution modes. Local mode executes the entire query on the frontend node, while distributed mode fragments the plan across compute nodes for parallel execution.
Usage
Use batch query serving when:
- Serving real-time dashboards reading from materialized views
- Running ad-hoc analytical queries over streaming results
- Integrating with BI tools via PostgreSQL protocol
- Validating streaming pipeline outputs
Theoretical Basis
Batch query execution follows the standard query processing pipeline:
SQL Query
|
v
[Parser] -- SQL text to AST
|
v
[Binder] -- resolve names and types
|
v
[Planner] -- logical plan
|
v
[Optimizer] -- physical plan with cost-based optimization
|
v
[Fragmenter] -- distributed execution plan
|
v
[Executor] -- local or distributed execution
|
v
[Results] -- returned via pgwire protocol