TimescaleDB maintains metadata about hypertables and provides views to query for the metadata. Views are located in schema timescaledb_information
and information about hypertables can be retrieved from timescaledb_information.hypertables
.
For example:
SELECT * FROM timescaledb_information.hypertables WHERE hypertable_name = 'data';
This API doc contains more information and examples.
Note that the time chunk interval can be changed over time, so the view doesn't provide information about it. So it is necessary to inspect every chunk to see its interval. This can be done by calling function chunk_relation_size_pretty
described in the doc here. For example:
SELECT chunk_table, partitioning_columns, ranges
FROM chunk_relation_size_pretty('data');
If you are in another schema, then it is necessary to specify fully qualified name of the hypertable as it expects an identifier:
SET SCHEMA 'test';
SELECT chunk_table, partitioning_columns, ranges
FROM public.chunk_relation_size_pretty('public.data');