Skip to content

Commit 5a62dd5

Browse files
authored
Update configuration.md
1 parent 7161f43 commit 5a62dd5

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

content/develop/data-types/timeseries/configuration.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,27 @@ When a compaction policy is defined, compaction rules will be created automatica
177177

178178
_key_agg_dur_aln_ where _key_ is the key of the source time series, _agg_ is the aggregator (in uppercase), _dur_ is the bucket duration in milliseconds, and _aln_ is the time bucket alignment in milliseconds. Example: `key_SUM_60000_1000`.
179179

180-
**Examples**
180+
#### Example rules
181181

182182
- `max:1M:1h` - Aggregate using `max` over one-minute windows and retain the last hour
183183
- `twa:1d:0m:360M` - Aggregate daily [06:00 .. 06:00) using `twa`; no expiration
184184

185+
#### Example
186+
187+
Setting a compaction policy composed of 5 compaction rules
188+
189+
Version < 8.0:
190+
191+
```
192+
$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
193+
```
194+
195+
Version >= 8.0:
196+
197+
```
198+
redis> CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
199+
```
200+
185201
### DUPLICATE_POLICY / ts-duplicate-policy
186202

187203
The default policy for handling insertion ([`TS.ADD`]({{< relref "/commands/ts.add/" >}}) and [`TS.MADD`]({{< relref "/commands/ts.madd/" >}})) of multiple samples with identical timestamps, with one of the following values:
@@ -199,32 +215,14 @@ The default value is applied to each new time series upon its creation.
199215

200216
Type: string
201217

202-
Default: `BLOCK`
203-
204218
**Precedence order**
205219

206220
Since the duplication policy can be provided at different levels, the actual precedence of the used policy will be:
207221

208222
1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument.
209223
1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument.
210224
1. The `ts-duplicate-policy` configuration parameter.
211-
1. The default policy.
212-
213-
#### Example
214-
215-
Setting a compaction policy composed of 5 compaction rules
216-
217-
Version < 8.0:
218-
219-
```
220-
$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
221-
```
222-
223-
Version >= 8.0:
224-
225-
```
226-
redis> CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
227-
```
225+
1. The default hard-coded policy (`BLOCK`)
228226

229227
### RETENTION_POLICY / ts-retention-policy
230228

0 commit comments

Comments
 (0)