@@ -106,18 +106,16 @@ If you are unfamiliar with the OHLC concept, please see our
106106
107107``` questdb-sql title="trades_OHLC_15m DDL"
108108CREATE MATERIALIZED VIEW 'trades_OHLC_15m'
109- WITH BASE 'trades' REFRESH INCREMENTAL
110- AS (
111- SELECT
112- timestamp, symbol,
113- first(price) AS open,
114- max(price) as high,
115- min(price) as low,
116- last(price) AS close,
117- sum(amount) AS volume
118- FROM trades
119- SAMPLE BY 15m
120- ) PARTITION BY MONTH;
109+ WITH BASE 'trades' REFRESH INCREMENTAL AS
110+ SELECT
111+ timestamp, symbol,
112+ first(price) AS open,
113+ max(price) as high,
114+ min(price) as low,
115+ last(price) AS close,
116+ sum(amount) AS volume
117+ FROM trades
118+ SAMPLE BY 15m;
121119```
122120
123121In this example:
@@ -132,12 +130,13 @@ In this example:
1321304 . The ` SAMPLE BY ` query contains two key column (` timestamp ` , ` symbol ` ) and
133131 five aggregates (` first ` , ` max ` , ` min ` , ` last ` , ` price ` ) calculated in ` 15m `
134132 time buckets.
135- 5 . The view is partitioned by ` DAY ` .
133+ 5 . The view is partitioned by ` MONTH ` . This partitioning is selected
134+ [ by default] ( #default-partitioning ) based on the ` SAMPLE BY ` interval.
1361356 . No TTL is defined
137136 - Therefore, the materialized view will contain a summary of _ all_ the base
138137 ` trades ` table's data.
139138
140- Many parts of the above DDL statement are optional and can be ommited :
139+ Many parts of the above DDL statement are optional and can be omitted :
141140
142141``` questdb-sql title="trades_OHLC_15m compact DDL"
143142CREATE MATERIALIZED VIEW 'trades_OHLC_15m' AS
@@ -357,20 +356,12 @@ useful.
357356
358357## Limitations
359358
360- ### Beta
361-
362359- Not all ` SAMPLE BY ` syntax is supported, for example, ` FILL ` .
363360- The ` INCREMENTAL ` refresh strategy relies on deduplicated inserts (O3 writes)
364- - We will instead delete a time range and insert the data as an append, which
365- is ** much** faster.
366- - This also means that currently, deduplication keys must be aligned across
361+ - This means that currently, deduplication keys must be aligned across
367362 the ` base ` table and the view.
368-
369- ### Post-release
370-
371363- Only ` INCREMENTAL ` refresh is supported
372- - We intend to add alternatives, such as:
373- - ` PERIODIC ` (once per partition),
364+ - In next versions, we intend to add alternatives, such as:
374365 - ` TIMER ` (once per time interval)
375366 - ` MANUAL ` (only when manually triggered)
376367- ` INCREMENTAL ` refresh is only triggered by inserts into the ` base ` table, not
@@ -496,7 +487,6 @@ Instead of storing the raw data, we will store one row, per symbol, per side,
496487per day of data.
497488
498489``` questdb-sql title="down-sampling test query" demo
499-
500490SELECT timestamp, symbol, side, price, amount, "latest" as timestamp FROM (
501491 SELECT timestamp,
502492 symbol,
0 commit comments