Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions api/hypertable/set_chunk_time_interval.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ UNIX epoch, set `chunk_time_interval` to 24 hours:
SELECT set_chunk_time_interval('conditions', 86400000);
```

## Required arguments
## Arguments

|Name|Type|Description|
|-|-|-|
|`hypertable`|REGCLASS|Hypertable or continuous aggregate to update interval for|
|`chunk_time_interval`|See note|Event time that each new chunk covers|

| Name | Type | Default | Required | Description |
|-------------|------------------|---------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|`hypertable`|REGCLASS| - | ✔ | Hypertable or continuous aggregate to update interval for. |
|`chunk_time_interval`|See note|- | ✔ | Event time that each new chunk covers. |
|`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. |

If you change chunk time interval you may see a chunk that is smaller than the new interval. For example, if you
have two 7-day chunks that cover 14 days, then change `chunk_time_interval` to 3 days, you may end up with a
transition chunk covering one day. This happens because the start and end of the new chunk is calculated based on
dividing the timeline by the `chunk_time_interval` starting at epoch 0. This leads to the following chunks
[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:
[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
created as a full 3 day chunk.

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

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

## Optional arguments

|TEXT|Description|
|-|-|-|
|`dimension_name`|REGCLASS|The name of the time dimension to set the number of partitions for|

You need to use `dimension_name` argument only if your hypertable has multiple
time dimensions.



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