Chandra Challagonda
Chandra Challagonda

Reputation: 11

Timescale db - multiple hyper tables on single Postgres Table

Can anyone help me with creating multiple timescale hyper tables on single Postgres table. I have a table with one value and 3 timestamp columns. I would like to create hyper table with every timestamp column.

Upvotes: 1

Views: 752

Answers (1)

Mike Freedman
Mike Freedman

Reputation: 1902

A hypertable is its own store of data, it's not a "view" on another PG table. So you can't make multiple hypertables "on" the same table.

If you are instead looking to move over to this hypertable format and just looking for a migration strategy, then it's easy. Execute

INSERT INTO hypertable_1 SELECT timestamp_1, value FROM old_table;

INSERT INTO hypertable_2 SELECT timestamp_2, value FROM old_table;

INSERT INTO hypertable_3 SELECT timestamp_3, value FROM old_table;

https://docs.timescale.com/latest/getting-started/migrating-data

That said, whether this data model is a good one is a different question, and would have to understand more of your use case.

You can join the Timescale community for more help at slack.timescale.com

Upvotes: 1

Related Questions