Skip to main content
Since 2.18.0 Retrieve compression statistics for the . For more information about using s, including size partitioning, see s.

Samples

To retrieve compression statistics:
  • Show the compression status of the conditions :
    SELECT * FROM hypertable_columnstore_stats('conditions');
    
    Returns:
    -[ 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_columnstore_stats('conditions');
    
    Returns:
    -[ RECORD 1 ]--+------
    total | 48 kB
    

Arguments

NameTypeDescription
hypertableREGCLASS to show statistics for

Returns

ColumnTypeDescription
total_chunksBIGINTThe number of s used by the . Returns NULL if compression_status == Uncompressed.
number_compressed_chunksINTEGERThe number of s used by the that are currently compressed. Returns NULL if compression_status == Uncompressed.
before_compression_table_bytesBIGINTSize of the heap before compression. Returns NULL if compression_status == Uncompressed.
before_compression_index_bytesBIGINTSize of all the indexes before compression. Returns NULL if compression_status == Uncompressed.
before_compression_toast_bytesBIGINTSize the TOAST table before compression. Returns NULL if compression_status == Uncompressed.
before_compression_total_bytesBIGINTSize of the entire table (before_compression_table_bytes + before_compression_index_bytes + before_compression_toast_bytes) before compression. Returns NULL if compression_status == Uncompressed.
after_compression_table_bytesBIGINTSize of the heap after compression. Returns NULL if compression_status == Uncompressed.
after_compression_index_bytesBIGINTSize of all the indexes after compression. Returns NULL if compression_status == Uncompressed.
after_compression_toast_bytesBIGINTSize the TOAST table after compression. Returns NULL if compression_status == Uncompressed.
after_compression_total_bytesBIGINTSize of the entire table (after_compression_table_bytes + after_compression_index_bytes + after_compression_toast_bytes) after compression. Returns NULL if compression_status == Uncompressed.
node_nameTEXTnodes on which the is located, applicable only to distributed s. Returns NULL if compression_status == Uncompressed.