获取与超表压缩相关的特定于数据块的统计信息。所有大小均以字节为单位。
此函数显示数据块的压缩大小,该大小在手动执行 compress_chunk
或压缩策略处理数据块时计算得出。插入压缩数据块不会更新压缩大小。有关如何计算数据块大小的更多信息,请参阅 chunks_detailed_size
部分。
名称 | 类型 | 描述 |
---|---|---|
hypertable | REGCLASS | 超表的名称 |
列 | 类型 | 描述 |
---|---|---|
chunk_schema | TEXT | 数据块的模式名称 |
chunk_name | TEXT | 数据块的名称 |
compression_status | TEXT | 数据块的当前压缩状态 |
before_compression_table_bytes | BIGINT | 压缩前堆的大小(如果当前未压缩,则为 NULL) |
before_compression_index_bytes | BIGINT | 压缩前所有索引的大小(如果当前未压缩,则为 NULL) |
before_compression_toast_bytes | BIGINT | 压缩前 TOAST 表的大小(如果当前未压缩,则为 NULL) |
before_compression_total_bytes | BIGINT | 压缩前整个数据块表(表+索引+TOAST)的大小(如果当前未压缩,则为 NULL) |
after_compression_table_bytes | BIGINT | 压缩后堆的大小(如果当前未压缩,则为 NULL) |
after_compression_index_bytes | BIGINT | 压缩后所有索引的大小(如果当前未压缩,则为 NULL) |
after_compression_toast_bytes | BIGINT | 压缩后 TOAST 表的大小(如果当前未压缩,则为 NULL) |
after_compression_total_bytes | BIGINT | 压缩后整个数据块表(表+索引+TOAST)的大小(如果当前未压缩,则为 NULL) |
node_name | TEXT | 数据块所在的节点,仅适用于分布式超表 |
SELECT * FROM chunk_compression_stats('conditions')ORDER BY chunk_name LIMIT 2;-[ RECORD 1 ]------------------+----------------------chunk_schema | _timescaledb_internalchunk_name | _hyper_1_1_chunkcompression_status | Uncompressedbefore_compression_table_bytes |before_compression_index_bytes |before_compression_toast_bytes |before_compression_total_bytes |after_compression_table_bytes |after_compression_index_bytes |after_compression_toast_bytes |after_compression_total_bytes |node_name |-[ RECORD 2 ]------------------+----------------------chunk_schema | _timescaledb_internalchunk_name | _hyper_1_2_chunkcompression_status | Compressedbefore_compression_table_bytes | 8192before_compression_index_bytes | 32768before_compression_toast_bytes | 0before_compression_total_bytes | 40960after_compression_table_bytes | 8192after_compression_index_bytes | 32768after_compression_toast_bytes | 8192after_compression_total_bytes | 49152node_name |
使用 pg_size_pretty
获取更友好的输出格式。
SELECT pg_size_pretty(after_compression_total_bytes) AS totalFROM chunk_compression_stats('conditions')WHERE compression_status = 'Compressed';-[ RECORD 1 ]--+------total | 48 kB
关键词
在此页面上发现问题?报告问题 或 在 GitHub 上编辑此页面。