PostgresQL Automating VACUUM FULL for bloated tables

前端 未结 2 1770
南方客
南方客 2021-02-09 05:05

We have a product using PostgreSQL database server that is deployed at a couple of hundred clients. Some of them have gathered tens of gigabytes of data over th

2条回答
  •  别那么骄傲
    2021-02-09 05:11

    You probably don't need it. It is good to do this once — after first archiving job so you'll get your disk space back but after that your daily archiving job and autovacuum will prevent dead tuples bloat.

    Also instead of vacuum full it is often better to run cluster table_name using index_name; analyze table_name. This will reorder rows according to an index. This way related table rows can be saved physically close on disk, which can limit disk seeking (important on classic disk drives, largely irrelevant on SSD) and a number of reads for your typical queries.

    And remember that both vacuum full and cluster will make your tables unusable while they run.

提交回复
热议问题