Coming soon to #QuestDB: live views. A live view is a table that stores the incrementally maintained result of a window function over a base table. As rows arrive, the window function runs once per new row and the output is appended, so you get one result row per input row: moving averages, running totals, rankings. You query it like any other table, and it scans precomputed rows instead of recomputing the window on every read. Where materialized views cover the SAMPLE BY side (OHLC bars, downsampled summaries), live views cover the OVER side: the row-per-input window computations. Here is what I ran to show it off. I started an ingestion script pushing 200,000 core prices per second. A couple of refreshes in the web console and we were already past 2 million rows. Then one statement, a CREATE LIVE VIEW with a moving average of the price. To show the read side, I opened three blotters against the view: one on localhost, one on a separate instance, one in the browser. All three updated in real time, around 10 times per second. The part I like most: a live view keeps its freshest computed rows in an in-memory tier and only persists them to its own disk tier on the FLUSH EVERY cadence. A full-row SELECT reads that in-memory tier, so the view reflects the latest computed prices before they are flushed to disk. FLUSH EVERY controls durability, not freshness. Standard SQL, streaming analytics, without leaving the database. More to come as we get closer to release.

To view or add a comment, sign in

Explore content categories