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 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 analyze
-
Apache + php3 + PostgreSQL的安装_PHP
-
PostgreSQL 慢查询SQL跟踪操作
-
postgresql 类似 oracle sql%rowcount 用法 的全局变量
-
PostgreSQL数据文件权限不对导致开机启动失败的问题
-
PostgreSQL 的schema access denied
-
PostgreSQL三种自增列sequence,serial,identity的用法区别
-
Ubuntu系统中Qt连PostgreSQL的问题解决
-
从 MongoDB 迁移到 PostgreSQL
-
在PostgreSQL上安装并使用扩展模块的教程