Create a hypertable
When you have created the relational table, you can create a hypertable. Creating tables and indexes, altering tables, inserting data, selecting data, and most other tasks are executed on the hypertable.
Create a
CREATE TABLESQL statement for your hypertable. Notice how the hypertable has the compulsory time column:Create a statement, execute the query you created in the previous step:
The by_range and by_hash dimension builder is an addition to TimescaleDB 2.13.
- Execute the two statements you created, and commit your changes to the database:
You can insert data into your hypertables in several different ways. In this section, you can insert single rows, or insert by batches of rows.
- Open a connection to the database, use prepared statements to formulate the
INSERTSQL statement, then execute the statement:
If you want to insert a batch of rows by using a batching mechanism. In this example, you generate some sample time-series data to insert into the sensor_data hypertable:
- Insert batches of rows:
This section covers how to execute queries against your database.