Tumbling window
Fixed, non-overlapping windows. Use them for per-minute order totals, hourly telemetry counts, or daily usage summaries.
Turn incoming events into tumbling or sliding window aggregates. BoilStream executes the SQL when each window closes and writes the results to an output table.
BoilStream supports three SQL view types on catalogs whose names end in __stream. They share DuckDB SQL syntax but differ in when they run and whether they produce a derived topic.
| View type | Best for | Execution | Output |
|---|---|---|---|
CREATE VIEW | Reusable query logic | Expanded at query time | No stored output |
CREATE STREAMING VIEW | Filter, project, and transform each row | Runs continuously as rows arrive | Derived topic with hot and cold tiers |
CREATE MATERIALIZED VIEW | Aggregations over time windows | Runs when each window closes | Stored result table |
Fixed, non-overlapping windows. Use them for per-minute order totals, hourly telemetry counts, or daily usage summaries.
Overlapping windows that advance on a separate slide interval. Use them for rolling averages, moving rates, and recent anomaly signals.
Window by an event timestamp column or omit it to use BoilStream's ingestion timestamp metadata.
-- One result row per region, per minute
CREATE MATERIALIZED VIEW sales_per_minute AS
SELECT
region,
SUM(amount) AS revenue,
COUNT(*) AS orders
FROM order_events
GROUP BY region
WITH (
window_type = 'tumbling',
window_size = '1 minute',
timestamp_column = 'event_time'
);
-- Five-minute average, refreshed every 30 seconds
CREATE MATERIALIZED VIEW avg_price_5m AS
SELECT AVG(price) AS avg_price, COUNT(*) AS samples
FROM quote_events
WITH (
window_type = 'sliding',
window_size = '5 minutes',
slide_interval = '30 seconds',
timestamp_column = 'created_at'
);
Because the query runs over window data, it can use DuckDB aggregations, GROUP BY, scalar functions, and CASE expressions. See the view guide for setup and window configuration.
Pre-aggregate event streams into smaller output tables for dashboard queries.
Calculate counts, rates, sums, and averages on event-time windows without maintaining a separate stream-processing application.
Filter rows with streaming views and aggregate windows with materialized views. Check downstream results and completion for the deployed release.
A streaming view processes each row independently for filters, projections, and transformations. A materialized view runs a batch query over a completed time window and can aggregate many rows.
Yes. Use GROUP BY to calculate metrics by region, product, device, or another column in your source data.
Query the output table with SQL and use the summaries in dashboards, reports, and applications.
No. You can omit timestamp_column to window by BoilStream's ingestion timestamp. Provide an event-time column when source timestamps should determine the windows.