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)