Create a hypertable

Creating a hypertable is a two-step process.

  1. Create a standard table (PostgreSQL docs).

    CREATE TABLE conditions (
        time        TIMESTAMPTZ       NOT NULL,
        location    TEXT              NOT NULL,
        temperature DOUBLE PRECISION  NULL
  2. Execute the TimescaleDB create_hypertable command on this newly created table, or use create_distributed_hypertable to create a distributed hypertable that scales out across multiple data nodes.

    SELECT create_hypertable('conditions', 'time');

If you need to migrate data from an existing table to a hypertable, make sure to set the migrate_data argument to true when calling the function. If you would like finer control over index formation and other aspects of your hypertable, follow these migration instructions instead.


The use of the migrate_data argument to convert a non-empty table can lock the table for a significant amount of time, depending on how much data is in the table.


The 'time' column used in the create_hypertable function supports timestamp, date, or integer types, so you can use a parameter that is not explicitly time-based, as long as it can increment. For example, a monotonically increasing id would work.

Found an issue on this page?

Report an issue!


Related Content