欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Postgresql vacuum analyze

程序员文章站 2024-01-11 20:50:46
...
There is no VACUUM statement in the SQL standard.

Postgresql has command VACUUM to cleanup dead tuples in database tables. After deletion, a record still stays in the table, VACUUM makes sure the space is reclaimed and made available for re-use.

Option ANALYZE would "Updates statistics used by the planner to determine the most efficient way to execute a query".

So the common usage of it would be running command "VACUUM ANALYZE" after done a bulk deletion and/or update. This would vacuum the whole database. You can append a specific table name after the command to just vacuum the table: "VACUUM ANALYZE your-table-name", like "vacuum analyze fscore.geofence_event;"

Postgres has an Autovacuum Daemon which would automatically vacuum+analyze the database. This setting is turned on by default and you can check it on by running this command: "show autovacuum;"

AWS RDS of postgres also has it on by default.
相关标签: postgresql vacuum