mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Since create_hypertable() allows you to optionally specify a partitioning column, it makes sense to default to one partition when no column is specified and asking for the number of partitions when a column is specified and the number of partitions is not (instead of defaulting to one). This patch also changes the order and type of partitioning-related input arguments to create_hypertable() so that the number of partitions can easily be specified alongside the partitioning column and without type casting.
12 lines
330 B
Plaintext
12 lines
330 B
Plaintext
CREATE TABLE conditions (
|
|
time BIGINT NOT NULL,
|
|
device_id TEXT NOT NULL,
|
|
temp DOUBLE PRECISION NULL,
|
|
humidity DOUBLE PRECISION NULL
|
|
);
|
|
|
|
CREATE INDEX ON conditions (time DESC NULLS LAST, device_id);
|
|
CREATE INDEX ON conditions (time DESC NULLS LAST, temp);
|
|
|
|
SELECT create_hypertable('"conditions"', 'time', 'device_id', 2);
|