Postgresql vacuum analyze

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.

猜你喜欢

转载自jxee.iteye.com/blog/2422756