如何使用PostgreSQL执行真空?

时间:2022-09-20 15:07:41

I need to vacuum the PostgreSQL database in production server. I am very new to do this. So anybody knows the PostgreSQL steps, please guide me.

我需要在生产服务器中清空PostgreSQL数据库。我很擅长这样做。所以任何人都知道PostgreSQL的步骤,请指导我。

I think it's very useful to improve the performance of PostgreSQL in production server.

我认为在生产服务器中提高PostgreSQL的性能非常有用。

2 个解决方案

#1


9  

Connect to the database and issue this command: "VACUUM". This causes a run in "lazy mode" that can be used during normal production use. It is recommended you actually invoke it as "vacuum analyze" which will also update statistics.

连接到数据库并发出以下命令:“VACUUM”。这导致在“懒惰模式”下运行,可以在正常生产使用期间使用。建议你实际调用它作为“真空分析”,它也会更新统计数据。

If you want to see lots of detail, you can at the console type "vacuum verbose"

如果你想看到很多细节,你可以在控制台上输入“vacuum verbose”

The more extreme form is "vacuum full" which causes heavy table locking and cannot really be used on a production system.

更极端的形式是“真空充满”,这会导致严重的工作台锁定,并且无法真正用于生产系统。

Source: http://www.postgresql.org/docs/8.1/static/maintenance.html

资料来源:http://www.postgresql.org/docs/8.1/static/maintenance.html

#2


3  

If you're running a recent version of PostgreSQL you likely have auto-vacuum running so the benefits of running VACUUM manually may be very minimal.

如果您运行的是最新版本的PostgreSQL,则可能会自动运行真空,因此手动运行VACUUM的好处可能非常小。

#1


9  

Connect to the database and issue this command: "VACUUM". This causes a run in "lazy mode" that can be used during normal production use. It is recommended you actually invoke it as "vacuum analyze" which will also update statistics.

连接到数据库并发出以下命令:“VACUUM”。这导致在“懒惰模式”下运行,可以在正常生产使用期间使用。建议你实际调用它作为“真空分析”,它也会更新统计数据。

If you want to see lots of detail, you can at the console type "vacuum verbose"

如果你想看到很多细节,你可以在控制台上输入“vacuum verbose”

The more extreme form is "vacuum full" which causes heavy table locking and cannot really be used on a production system.

更极端的形式是“真空充满”,这会导致严重的工作台锁定,并且无法真正用于生产系统。

Source: http://www.postgresql.org/docs/8.1/static/maintenance.html

资料来源:http://www.postgresql.org/docs/8.1/static/maintenance.html

#2


3  

If you're running a recent version of PostgreSQL you likely have auto-vacuum running so the benefits of running VACUUM manually may be very minimal.

如果您运行的是最新版本的PostgreSQL,则可能会自动运行真空,因此手动运行VACUUM的好处可能非常小。