Skip to content

Creating Your First Hypertable

Hands-on guide to creating and configuring hypertables

Tiger Data 101 → TimescaleDB | Section: Hypertables | ⏱ Time: ~2 min

The recommended approach is to use the modern CREATE TABLE syntax with the tsdb.hypertable option:

CREATE TABLE sensor_readings (
time TIMESTAMPTZ NOT NULL,
device_id TEXT NOT NULL,
temperature FLOAT,
humidity FLOAT
) WITH (tsdb.hypertable, tsdb.partition_column = 'time');

Or, if you already have a regular table, convert it:

SELECT create_hypertable('sensor_readings', by_range('time'));

TimescaleDB automatically chooses chunk intervals (typically 7 days for new data), but you can customize:

ALTER TABLE sensor_readings SET (
timescaledb.chunk_time_interval = INTERVAL '1 day'
);

Guidelines:

  • Smaller intervals (1 hour – 1 day): For high-cardinality or very high write volume
  • Medium intervals (1 week): Good default for most use cases
  • Larger intervals (1 month+): For lower cardinality or sparse data