Old API since v2.18.0. Superseded by hypertable_columnstore_stats().
However, compression APIs are still supported, you do not need to migrate to the hypercore APIs.
Get statistics related to compression. All sizes are in bytes.
For more information about using s, including size partitioning, see the hypertable
section.
For more information about compression, see the compression section.
Samples
SELECT * FROM hypertable_compression_stats('conditions');
-[ RECORD 1 ]------------------+------
total_chunks | 4
number_compressed_chunks | 1
before_compression_table_bytes | 8192
before_compression_index_bytes | 32768
before_compression_toast_bytes | 0
before_compression_total_bytes | 40960
after_compression_table_bytes | 8192
after_compression_index_bytes | 32768
after_compression_toast_bytes | 8192
after_compression_total_bytes | 49152
node_name |
Use pg_size_pretty get the output in a more human friendly format.
SELECT pg_size_pretty(after_compression_total_bytes) as total
FROM hypertable_compression_stats('conditions');
-[ RECORD 1 ]--+------
total | 48 kB
Arguments
The syntax is:
SELECT * FROM hypertable_compression_stats(
hypertable = '<hypertable_name>'
);
| Name | Type | Default | Required | Description |
|---|
hypertable | REGCLASS | - | ✔ | to show statistics for |
Returns
| Column | Type | Description |
|---|
total_chunks | BIGINT | The number of s used by the |
number_compressed_chunks | BIGINT | The number of s used by the 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 is located, applicable only to distributed s |
Returns show NULL if the data is currently uncompressed.