Skip to content

Commit 25160d4

Browse files
chore: add note about chunks. (#4420)
* chore: add note about chunks. * chore: update on review. * Update api/hypertable/set_chunk_time_interval.md Co-authored-by: Erik Nordström <819732+erimatnor@users.noreply.github.com> Signed-off-by: Iain Cox <iain@timescale.com> * chore: update on review. --------- Signed-off-by: Iain Cox <iain@timescale.com> Co-authored-by: billy-the-fish <iain@tigerdata.com> Co-authored-by: Erik Nordström <819732+erimatnor@users.noreply.github.com>
1 parent 702414c commit 25160d4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

api/hypertable/set_chunk_time_interval.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@ UNIX epoch, set `chunk_time_interval` to 24 hours:
3232
SELECT set_chunk_time_interval('conditions', 86400000);
3333
```
3434

35-
## Required arguments
35+
## Arguments
3636

37-
|Name|Type|Description|
38-
|-|-|-|
39-
|`hypertable`|REGCLASS|Hypertable or continuous aggregate to update interval for|
40-
|`chunk_time_interval`|See note|Event time that each new chunk covers|
37+
38+
| Name | Type | Default | Required | Description |
39+
|-------------|------------------|---------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
40+
|`hypertable`|REGCLASS| - || Hypertable or continuous aggregate to update interval for. |
41+
|`chunk_time_interval`|See note|- || Event time that each new chunk covers. |
42+
|`dimension_name`|REGCLASS|- || The name of the time dimension to set the number of partitions for. Only use `dimension_name` when your hypertable has multiple time dimensions. |
43+
44+
If you change chunk time interval you may see a chunk that is smaller than the new interval. For example, if you
45+
have two 7-day chunks that cover 14 days, then change `chunk_time_interval` to 3 days, you may end up with a
46+
transition chunk covering one day. This happens because the start and end of the new chunk is calculated based on
47+
dividing the timeline by the `chunk_time_interval` starting at epoch 0. This leads to the following chunks
48+
[0, 3), [3, 6), [6, 9), [9, 12), [12, 15), [15, 18) and so on. The two 7-day chunks covered data up to day 14:
49+
[0, 7), [8, 14), so the 3-day chunk for [12, 15) is reduced to a one day chunk. The following chunk [15, 18) is
50+
created as a full 3 day chunk.
4151

4252
The valid types for the `chunk_time_interval` depend on the type used for the
4353
hypertable `time` column:
@@ -56,15 +66,5 @@ hypertable `time` column:
5666

5767
For more information, see [hypertable partitioning][hypertable-partitioning].
5868

59-
## Optional arguments
60-
61-
|TEXT|Description|
62-
|-|-|-|
63-
|`dimension_name`|REGCLASS|The name of the time dimension to set the number of partitions for|
64-
65-
You need to use `dimension_name` argument only if your hypertable has multiple
66-
time dimensions.
67-
68-
6969

7070
[hypertable-partitioning]: /use-timescale/:currentVersion:/hypertables/#hypertable-partitioning

0 commit comments

Comments
 (0)