Max Tet
Max Tet

Reputation: 755

Hypertable time-based partitions with denormalized date column

typical data warehouse db schemata often follow a star schema with denormalized date and time columns. That means that the fact table (the one that should be a hypertable when using timescaledb) has no column containing a timestamp but instead has foreign keys to the data and time tables.

Is there a way to make timescaledb aware of this and partition the fact table correctly despite this? Or is a timestamp-column a hard requirement for a hypertable?

Thanks

Upvotes: 0

Views: 664

Answers (1)

k_rus
k_rus

Reputation: 3219

Timescale requires to provide a time column for partitioning. It is not required to be a timestamp, but can be, for example, an integer value. See the doc

If int is used instead of time, it is important that it increases in the same way as the time. Note that in such case it is necessary to provide chunk_time_interval.

It is also possible to provide time_partitioning_func, which will convert references into time compatible values.

See description of create_hypertable

Upvotes: 3

Related Questions