set_chunk_time_interval()

Sets the chunk_time_interval on a hypertable. The new interval is used when new chunks are created, and time intervals on existing chunks are not changed.

Required arguments

NameTypeDescription
hypertableREGCLASSHypertable to update interval for
chunk_time_intervalSee noteEvent time that each new chunk covers

The valid types for the chunk_time_interval depend on the type used for the hypertable time column:

time column typechunk_time_interval typeTime unit
TIMESTAMPINTERVALdays, hours, minutes, etc
INTEGER or BIGINTmicroseconds
TIMESTAMPTZINTERVALdays, hours, minutes, etc
INTEGER or BIGINTmicroseconds
DATEINTERVALdays, hours, minutes, etc
INTEGER or BIGINTmicroseconds
SMALLINTSMALLINTThe same time unit as the time column
INTINTThe same time unit as the time column
BIGINTBIGINTThe same time unit as the time column

For more information, see the create_hypertable section.

Optional arguments

TEXTDescription
dimension_nameREGCLASSThe 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.

Sample usage

For a TIMESTAMP column, set chunk_time_interval to 24 hours:

  1. SELECT set_chunk_time_interval('conditions', INTERVAL '24 hours');
  2. SELECT set_chunk_time_interval('conditions', 86400000000);

For a time column expressed as the number of milliseconds since the UNIX epoch, set chunk_time_interval to 24 hours:

  1. SELECT set_chunk_time_interval('conditions', 86400000);