Since 1.5.0
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 hypertableREGCLASS - ✔ to show statistics for
Returns
Column Type Description total_chunksBIGINT The number of s used by the number_compressed_chunksBIGINT The number of s used by the that are currently compressed before_compression_table_bytesBIGINT Size of the heap before compression before_compression_index_bytesBIGINT Size of all the indexes before compression before_compression_toast_bytesBIGINT Size the TOAST table before compression before_compression_total_bytesBIGINT Size of the entire table (table+indexes+toast) before compression after_compression_table_bytesBIGINT Size of the heap after compression after_compression_index_bytesBIGINT Size of all the indexes after compression after_compression_toast_bytesBIGINT Size the TOAST table after compression after_compression_total_bytesBIGINT Size of the entire table (table+indexes+toast) after compression node_nameTEXT nodes on which the is located, applicable only to distributed s
Returns show NULL if the data is currently uncompressed.