Skip to content

Commit 3b2e97e

Browse files
authored
invalidation engine clarification for CAGGs (#4557)
1 parent e37705a commit 3b2e97e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

use-timescale/continuous-aggregates/about-continuous-aggregates.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,21 @@ materialization threshold forward in time. This ensures that the threshold lags
263263
behind the point-in-time where data changes are common, and that most INSERTs do
264264
not require any extra writes.
265265

266-
When data older than the invalidation threshold is changed, the maximum and
267-
minimum timestamps of the changed rows is logged, and the values are used to
268-
determine which rows in the aggregation table need to be recalculated. This
269-
logging does cause some write load, but because the threshold lags behind the
270-
area of data that is currently changing, the writes are small and rare.
266+
When data older than the invalidation threshold is changed, each transaction
267+
logs the minimum and maximum timestamps of the rows it modified.
268+
The continuous aggregate then identifies which complete time buckets are affected
269+
based on this per-transaction tracking. The range of buckets that are recalculated
270+
depends on transaction boundaries:
271+
272+
* If you modify rows in the 10:00 bucket and rows in the 15:00 bucket within a
273+
**single transaction**, all buckets from 10:00 to 15:00 (including intermediate
274+
buckets 11:00, 12:00, 13:00, and 14:00) are recalculated during refresh.
275+
* If you modify rows in the 10:00 bucket in one transaction and rows in the 15:00
276+
bucket in a **separate transaction**, only the 10:00 and 15:00 buckets are
277+
recalculated. The intermediate buckets (11:00, 12:00, 13:00, 14:00) are not affected.
278+
279+
This logging does cause some write load. However, the threshold lags behind the
280+
area of data that is currently changing, so the writes are small and rare.
271281

272282
[cagg-mat-hypertables]: /use-timescale/:currentVersion:/continuous-aggregates/materialized-hypertables
273283
[cagg-window-functions]: /use-timescale/:currentVersion:/continuous-aggregates/create-a-continuous-aggregate/#use-continuous-aggregates-with-window-functions

0 commit comments

Comments
 (0)