CLUSTER使用(释放空间)

 

db_test=# create index idx_name1 on tb_aa(name1);
CREATE INDEX

db_test=# SELECT pg_size_pretty(pg_total_relation_size('tb_aa'));
pg_size_pretty
----------------
2469 MB
(1 row)

db_test=# delete from tb_aa;
DELETE 20000002


db_test=# cluster tb_aa USING idx_name1; ##阻塞,无法进行dml,也无法查询
CLUSTER

db_test=# SELECT pg_size_pretty(pg_total_relation_size('tb_aa'));
pg_size_pretty
----------------
16 kB
(1 row)

posted @ 2022-12-02 16:33  slnngk  阅读(30)  评论(0编辑  收藏  举报