PostgreSQL:VACCUM FULL vs pg_dump and restore [英] PostgreSQL: VACCUM FULL vs pg_dump and restore
问题描述
pg_dump是否与VACCUM FULL相同?
我想在晚上清理数据库,但VACCUM FULL需要太多时间。 pg_dump还会清除数据库中不需要的数据吗?
Does pg_dump do the same thing as VACCUM FULL? I wan to clean a database at night but VACCUM FULL takes too much time. Does pg_dump also clear database form unwanted data?
推荐答案
假设您创建了一个新数据库并还原了转储,两者的效果
Assuming that you create a new database and restore the dump, the effect of both operations would be pretty much the same.
最大的问题是为什么您认为需要采取如此极端的措施。通常,autovacuum应该处理无效的元组,并且如果您有一个在其上执行批量更新或删除的表,则可以考虑仅在该表上使用 VACUUM(FULL)
。
The big question is why you think you need such extreme measures. Normally autovacuum should take care of dead tuples, and if you have a table on which you perform bulk updates or deletes, you might consider using VACUUM (FULL)
on that table only.
这篇关于PostgreSQL:VACCUM FULL vs pg_dump and restore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!