Skip to content

Create and configure a hypertable

Create a hypertable, set chunk intervals, control default indexes, and migrate existing data

Hypertables turn ordinary PostgreSQL tables into time-partitioned tables made of chunks, so you can scale to very large datasets. Add WITH (timescaledb.hypertable) to a standard CREATE TABLE statement to create one.

Create a hypertable from scratch in Tiger Console or with SQL.

To create a hypertable in Tiger Console:

  1. Select your service, then click Actions
  2. Under Goals, find Create a hypertable and click Get started

    In the wizard, select the Create new table tab.

    Create a hypertable wizard in Tiger Console
  3. Name the table

    Under Name table, enter a name, then click Continue. The name must start with a letter or an underscore, and can contain only letters, numbers, and underscores.

  4. Configure the partition column

    Under Configure, set the Name and Type of the column used to partition data into chunks, for example created_at with type TIMESTAMP WITH TIME ZONE. Optionally, select an Additional dimension to partition on a secondary column. Click Continue.

  5. Create the hypertable

    Under Create hypertable, review the generated SQL, then click Run and proceed. Your new table is created as a hypertable.

    Generated SQL in the Create a hypertable wizard

Set these options in the WITH clause to control how the hypertable is created:

OptionDefaultDescription
timescaledb.hypertableRequired. Marks the table as a hypertable.
timescaledb.partition_columnAuto-detectedThe column used to partition data into chunks. Auto-detected from the first timestamptz column. Required if the table has no timestamptz column or has more than one.
timescaledb.chunk_interval7 daysThe time range each chunk covers. Tune this for your ingest rate and memory. See Sizing hypertable chunks.
timescaledb.create_default_indexestrueCreates an index on the partition column automatically. Set to false for large bulk loads where you want to add indexes after loading.

Choose a chunk interval so that all active chunks fit in memory. The default is 7 days, which works well for many workloads. For high-throughput ingestion, a shorter interval like 1 day may be better:

CREATE TABLE high_throughput_metrics (
time TIMESTAMPTZ NOT NULL,
device_id INT,
value DOUBLE PRECISION
) WITH (
timescaledb.hypertable,
timescaledb.chunk_interval = '1 day'
);

For large bulk loads into a new hypertable, skip automatic index creation and add indexes after the data is loaded:

CREATE TABLE bulk_load_target (
time TIMESTAMPTZ NOT NULL,
device_id INT,
value DOUBLE PRECISION
) WITH (
timescaledb.hypertable,
timescaledb.create_default_indexes = false
);
-- Load data first, then create indexes
CREATE INDEX ON bulk_load_target (time DESC);
CREATE INDEX ON bulk_load_target (device_id, time DESC);

Convert an existing PostgreSQL table that already has data to a hypertable in Tiger Console or with SQL.

To convert an existing table in Tiger Console:

  1. Select your service, then click Actions
  2. Under Goals, find Create a hypertable and click Get started

    In the wizard, select the Convert existing table tab.

    Create a hypertable wizard in Tiger Console
  3. Choose the table to convert

    Under Choose a table, select the PostgreSQL table you want to convert.

  4. Configure the partition column

    Under Configure, select the column used to partition data into chunks, for example time. If the wizard reports Primary key change required, click Run to update the primary key, then continue.

  5. Transform the table into a hypertable

    Your table is converted to a hypertable.

    A table converted to a hypertable in Tiger Console