Nyx*_*nyx 6 sql postgresql timescaledb
为了确定我my_table的 TimescaleDB表(之前创建了一个超表)的大小,我运行了 SQL 查询
pg_size_pretty( pg_total_relation_size('my_table') );
Run Code Online (Sandbox Code Playgroud)
但是,尽管此表中有 10k 行,但此查询返回的大小为24 kB。
使用 SQL 查询查询数据库的大小给出了更合理的34 MB大小
SELECT pg_size_pretty( pg_database_size('database_development') );
Run Code Online (Sandbox Code Playgroud)
问题:计算 TimescaleDB 表大小的正确方法是什么?
使用 PostgreSQL 11.5,TimescaleDB 1.5.1
我们通常建议使用 TimescaleDB 特定的函数:
https://docs.timescale.com/latest/api#hypertable_relation_size https://docs.timescale.com/latest/api#hypertable_relation_size_pretty
如果您有兴趣获取有关每个/特定块的信息:
https://docs.timescale.com/latest/api#chunk_relation_size https://docs.timescale.com/latest/api#chunk_relation_size_pretty
| 归档时间: |
|
| 查看次数: |
4908 次 |
| 最近记录: |