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.

NameTypeDescription
hypertableREGCLASSHypertable to show statistics for
ColumnTypeDescription
total_chunksBIGINTThe number of chunks used by the hypertable
number_compressed_chunksINTEGERThe number of chunks used by the hypertable that are currently compressed
before_compression_table_bytesBIGINTSize of the heap before compression
before_compression_index_bytesBIGINTSize of all the indexes before compression
before_compression_toast_bytesBIGINTSize the TOAST table before compression
before_compression_total_bytesBIGINTSize of the entire table (table+indexes+toast) before compression
after_compression_table_bytesBIGINTSize of the heap after compression
after_compression_index_bytesBIGINTSize of all the indexes after compression
after_compression_toast_bytesBIGINTSize the TOAST table after compression
after_compression_total_bytesBIGINTSize of the entire table (table+indexes+toast) after compression
node_nameTEXTnodes 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 | 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

Keywords

Found an issue on this page?

Report an issue!