Timescale Cloud:性能、扩展、企业级

自托管产品

MST

自 TimescaleDB v2.18.0 起为旧 API 已被 hypertable_columnstore_stats() 取代。

获取与超表压缩相关的统计信息。所有大小均以字节为单位。

有关使用超表(包括分块大小分区)的更多信息,请参阅超表部分

有关压缩的更多信息,请参阅压缩部分

名称类型描述
hypertableREGCLASS要显示统计信息的超表
类型描述
total_chunksBIGINT超表使用的分块数量
number_compressed_chunksBIGINT超表使用的当前已压缩的分块数量
before_compression_table_bytesBIGINT压缩前的堆大小
before_compression_index_bytesBIGINT压缩前所有索引的大小
before_compression_toast_bytesBIGINT压缩前 TOAST 表的大小
before_compression_total_bytesBIGINT压缩前整个表(表+索引+TOAST)的大小
after_compression_table_bytesBIGINT压缩后的堆大小
after_compression_index_bytesBIGINT压缩后所有索引的大小
after_compression_toast_bytesBIGINT压缩后 TOAST 表的大小
after_compression_total_bytesBIGINT压缩后整个表(表+索引+TOAST)的大小
node_nameTEXT超表所在的节点,仅适用于分布式超表
注意

如果数据当前未压缩,则返回 NULL

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 |

使用 pg_size_pretty 以更易读的格式获取输出。

SELECT pg_size_pretty(after_compression_total_bytes) as total
FROM hypertable_compression_stats('conditions');
-[ RECORD 1 ]--+------
total | 48 kB

关键词

在此页面上发现问题?报告问题 或 在 GitHub 上编辑此页面