dead_Joker 发表于 2012-02-17 08:32

vacuumdb 清理空间问题

对于经常增删数据的表,做vacuumdb操作(不加f参数),能够重用空间。

但这样做,就像物理硬盘一样,会不会也产生碎片呢?

dead_Joker 发表于 2012-02-17 14:10

{:3_198:}没人回呀

asdf2110 发表于 2012-03-19 11:01

应该不会,vacuum 会把已删除的挂在空闲链表上,下次分配时直接在空闲链表上找可用空间,具体细节不太清楚

wang1352083 发表于 2012-03-19 22:38

vacuum 将空间返回给os

dead_Joker 发表于 2012-03-20 18:03

thanks dudes :D)

longshort 发表于 2012-03-23 17:37

这个基本上不是问题,每天定时运行一次会很轻松,碎片不会累积。

yanghong709 发表于 2012-04-09 22:05

vacuum的时候,只是把不需要的数据打上标志,表示这些数据已经过期,可以覆盖这些数据了。而vacuum full就是彻底的回收数据所占用的空间,返还给OS。

jiang870320 发表于 2016-03-01 09:47

vacuum analyse verbose 会,select relname,relkind,reltuples,relpages from pg_class where relkind='i' and relname like 'xxx'; 对比前后差距

归隐乡村 发表于 2016-05-05 10:02

Plain VACUUM (without FULL) simply reclaims space and makes it available for re-use. extra space is not returned to the operating system (in most cases); it’s just kept available for re-use within the same table. VACUUM FULL rewrites the entire contents of the table into a new disk file with no extra space, allowing unused space to be returned to the operating system. This form is much slower and requires an exclusive lock on each table while it is being processed.
页: [1]
查看完整版本: vacuumdb 清理空间问题