=> SELECT pg_size_pretty(pg_database_size('myproject')); pg_size_pretty ---------------- 9415 kB (1 row) => SELECT pg_size_pretty(pg_relation_size('mytable')); pg_size_pretty ---------------- 8192 bytes (1 row)
汗,postgresql从8.1就提供了查看物理存储空间的函数了……
还可以显示为更易读的格式: