hypertable_compression_stats()
CommunityCommunity functions are available under Timescale Community Edition. Click to learn more.Get statistics related to hypertable compression. All sizes are in bytes.
For more information about using hypertables, including chunk size partitioning, see the hypertable section.
For more information about compression, see the compression sction.
Name | Type | Description |
---|---|---|
hypertable | REGCLASS | Hypertable to show statistics for |
Column | Type | Description |
---|---|---|
total_chunks | BIGINT | The number of chunks used by the hypertable |
number_compressed_chunks | INTEGER | The number of chunks used by the hypertable that are currently compressed |
before_compression_table_bytes | BIGINT | Size of the heap before compression |
before_compression_index_bytes | BIGINT | Size of all the indexes before compression |
before_compression_toast_bytes | BIGINT | Size the TOAST table before compression |
before_compression_total_bytes | BIGINT | Size of the entire table (table+indexes+toast) before compression |
after_compression_table_bytes | BIGINT | Size of the heap after compression |
after_compression_index_bytes | BIGINT | Size of all the indexes after compression |
after_compression_toast_bytes | BIGINT | Size the TOAST table after compression |
after_compression_total_bytes | BIGINT | Size of the entire table (table+indexes+toast) after compression |
node_name | TEXT | nodes on which the hypertable is located, applicable only to distributed hypertables |
Note
Returns show NULL
if the data is currently uncompressed.
SELECT * FROM hypertable_compression_stats('conditions');-[ RECORD 1 ]------------------+------total_chunks | 4number_compressed_chunks | 1before_compression_table_bytes | 8192before_compression_index_bytes | 32768before_compression_toast_bytes | 0before_compression_total_bytes | 40960after_compression_table_bytes | 8192after_compression_index_bytes | 32768after_compression_toast_bytes | 8192after_compression_total_bytes | 49152node_name |
Use pg_size_pretty
get the output in a more human friendly format.
SELECT pg_size_pretty(after_compression_total_bytes) as totalFROM hypertable_compression_stats('conditions');-[ RECORD 1 ]--+------total | 48 kB
Keywords
Found an issue on this page?Report an issue or Edit this page in GitHub.