You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _partials/_caggs-intro.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
import RealTimeAgg from 'versionContent/_partials/_real-time-aggregates.mdx';
2
+
1
3
In modern applications, data usually grows very quickly. This means that aggregating
2
4
it into useful summaries can become very slow. $CLOUD_LONG continuous aggregates make
3
5
aggregating data lightning fast, accurate, and easy.
@@ -24,13 +26,12 @@ Because continuous aggregates are based on hypertables, you can query them in
24
26
exactly the same way as your other tables, and enable [compression][compression]
25
27
or [tiered storage][data-tiering] on them. You can even
26
28
create
27
-
[continuous aggregates on top of your continuous aggregates][hierarchical-caggs] - for an even more fine-tuned aggregation.
29
+
[continuous aggregates on top of your continuous aggregates][hierarchical-caggs]—for an even more fine-tuned aggregation.
28
30
29
-
By default, querying continuous aggregates provides you with real-time data.
30
-
Pre-aggregated data from the materialized view is combined with recent data that
31
-
hasn't been aggregated yet. This gives you up-to-date results on every query.
31
+
[Real-time aggregation][real-time-aggregation] enables you to combine pre-aggregated data from the materialized view with the most recent raw data. This gives you up-to-date results on every query. <RealTimeAgg />
In $TIMESCALE_DB v2.13 and later, real-time aggregates are **DISABLED** by default. In earlier versions, real-time aggregates are **ENABLED** by default; when you create a continuous aggregate, queries to that view include the results from the most recent raw data.
import RealTimeAgg from 'versionContent/_partials/_real-time-aggregates.mdx';
8
+
7
9
# Hierarchical continuous aggregates
8
10
9
11
The more data you have, the more likely you are to run a more sophisticated analysis on it. When a simple one-level aggregation is not enough, $CLOUD_LONG lets you create continuous aggregates on top of other continuous aggregates. This way, you summarize data at different levels of granularity, while still saving resources with precomputing.
@@ -28,8 +30,7 @@ For more information, see the instructions for
28
30
29
31
## Use real-time aggregation with hierarchical continuous aggregates
30
32
31
-
In TimescaleDB v2.13 and later, real-time aggregates are *DISABLED* by default.
32
-
In TimescaleDB v1.7 to v2.12, real-time aggregates are *ENABLED* by default.
33
+
<RealTimeAgg />
33
34
34
35
Real-time aggregates always return up-to-date data in response to queries. They accomplish this by
35
36
joining the materialized data in the continuous aggregate with unmaterialized
import CaggsRealTimeHistoricalDataRefreshes from 'versionContent/_partials/_caggs-real-time-historical-data-refreshes.mdx';
9
+
import RealTimeAgg from 'versionContent/_partials/_real-time-aggregates.mdx';
9
10
10
11
# Real-time aggregates
11
12
@@ -14,14 +15,12 @@ Rapidly growing data means you need more control over what to aggregate and how
14
15
By default, continuous aggregates do not include the most recent data chunk from the
15
16
underlying hypertable. Real-time aggregates, however, use the aggregated data **and** add the
16
17
most recent raw data to it. This provides accurate and up-to-date results, without
17
-
needing to aggregate data as it is being written.
18
+
needing to aggregate data as it is being written.
18
19
19
-
In Timescale 2.13 and later real-time aggregates are *DISABLED* by default. In Timescale versions 1.7 to 2.12, real-time aggregates are enabled by default; when you create a continuous
20
-
aggregate view, queries to that view include the most recent data, even if
21
-
it has not yet been aggregated.
20
+
<RealTimeAgg />
22
21
23
22
For more detail on the comparison between continuous and real-time aggregates,
24
-
see our [realtime aggregate blog post][blog-rtaggs].
23
+
see our [real-time aggregate blog post][blog-rtaggs].
25
24
26
25
## Use real-time aggregates
27
26
@@ -30,16 +29,16 @@ You can enable and disable real-time aggregation by setting the
30
29
31
30
<Procedure>
32
31
33
-
1.For an existing table, at the `psql` prompt, disable real-time aggregation:
32
+
1.Enable real-time aggregation for an existing continuous aggregate:
34
33
35
34
```sql
36
-
ALTER MATERIALIZED VIEW table_name set (timescaledb.materialized_only=true);
35
+
ALTER MATERIALIZED VIEW table_name set (timescaledb.materialized_only=false);
37
36
```
38
37
39
-
1. Re-enablereal-time aggregation:
38
+
1. Disablereal-time aggregation:
40
39
41
40
```sql
42
-
ALTER MATERIALIZED VIEW table_name set (timescaledb.materialized_only = false);
41
+
ALTER MATERIALIZED VIEW table_name set (timescaledb.materialized_only = true);
Copy file name to clipboardExpand all lines: use-timescale/continuous-aggregates/refresh-policies.md
+10-16
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ you can also refresh it manually.
16
16
Continuous aggregates require a policy for automatic refreshing. You can adjust
17
17
this to suit different use cases. For example, you can have the continuous
18
18
aggregate and the hypertable stay in sync, even when data is removed from the
19
-
hypertable, or you could keep source data in the continuous aggregate even after
19
+
hypertable. Alternatively, you could keep source data in the continuous aggregate even after
20
20
it is removed from the hypertable.
21
21
22
22
You can change the way your continuous aggregate is refreshed by calling
@@ -30,15 +30,15 @@ Among others, `add_continuous_aggregate_policy` takes the following arguments:
30
30
*`schedule_interval`: the refresh interval in minutes or hours. Defaults to
31
31
24 hours.
32
32
33
-
If you set the `start_offset` or `end_offset` to `NULL`, the range is open-ended
34
-
and extends to the beginning or end of time.
33
+
Note the following:
35
34
36
-
If you set `end_offset` within the current time bucket, this bucket is excluded. This is done for the following reasons:
35
+
- If you set the `start_offset` or `end_offset` to `NULL`, the range is open-ended and extends to the beginning or end of time.
36
+
- If you set `end_offset` within the current time bucket, this bucket is excluded from materialization. This is done for the following reasons:
37
37
38
-
- The current bucket is incomplete and can't be refreshed.
39
-
- The current bucket gets lots of writes in the time-stamp order and its aggregate becomes outdated very quickly. Excluding it improves performance.
38
+
- The current bucket is incomplete and can't be refreshed.
39
+
- The current bucket gets a lot of writes in the time-stamp order, and its aggregate becomes outdated very quickly. Excluding it improves performance.
40
40
41
-
To include the current time bucket, enable [real-time aggregation][future-watermark]. In Timescale 2.13 and later, it is disabled by default.
41
+
To include the latest raw data in queries, enable [real-time aggregation][future-watermark].
42
42
43
43
See the [API reference][api-reference] for the full list of required and optional arguments and use examples.
44
44
@@ -117,10 +117,10 @@ The `refresh` command takes three arguments:
117
117
* The timestamp of the beginning of the refresh window
118
118
* The timestamp of the end of the refresh window
119
119
120
-
Only buckets that are wholly within the range specified are refreshed. For
120
+
Only buckets that are wholly within the specified range are refreshed. For
121
121
example, if you specify `2021-05-01', '2021-06-01` the only buckets that are
122
122
refreshed are those up to but not including 2021-06-01. It is possible to
123
-
specify NULL in a manual refresh to get an open-ended range, but we do not
123
+
specify `NULL` in a manual refresh to get an open-ended range, but we do not
124
124
recommend using it, because you could inadvertently materialize a large amount
125
125
of data, slow down your performance, and have unintended consequences on other
126
126
policies like data retention.
@@ -137,13 +137,7 @@ policies like data retention.
137
137
138
138
</Procedure>
139
139
140
-
Avoid refreshing time intervals that are likely to have a lot of writes. In
141
-
general, this means you should never refresh the most recent time bucket.
142
-
Because the of constant change in the underlying data, they are unlikely to
143
-
produce accurate aggregates. Additionally, refreshing this data slows down the
144
-
ingest rate of the hypertable due to write amplification. If you want to include
145
-
the latest bucket in your queries,
146
-
use [real-time aggregation][real-time-aggregates] instead.
140
+
Follow the logic used by automated refresh policies and avoid refreshing time buckets that are likely to have a lot of writes. This means that you should generally not refresh the latest incomplete time bucket. To include the latest raw data in your queries, use [real-time aggregation][real-time-aggregates] instead.
0 commit comments