Frage

From everything I have read about VACUUM FULL, I would expect it to lock the database I'm running it on, but it renders every database in the cluster inaccessible. Is there perhaps something we might have wrong in our configuration? I do have autovacuum on, but we have a few unwieldy databases I'd like to clean up thoroughly. This is PostgreSQL v10. Thanks for any insights.

War es hilfreich?

Lösung

I'm considering below is the reason from PostgreSQL v10 documentation:(https://www.postgresql.org/docs/10/sql-vacuum.html)

The FULL option is not recommended for routine use, but might be useful in special cases. An example is when you have deleted or updated most of the rows in a table and would like the table to physically shrink to occupy less disk space and allow faster table scans. VACUUM FULL will usually shrink the table more than a plain VACUUM would.

VACUUM causes a substantial increase in I/O traffic, which might cause poor performance for other active sessions. Therefore, it is sometimes advisable to use the cost-based vacuum delay feature. See Section 19.4.4 for details.

https://www.postgresql.org/docs/10/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST

In your case, it might have happened because all databases in the cluster shares common resource, if it's on the same server.

Andere Tipps

Some tables are shared between all databases of a cluster: pg_database, pg_tablespace, pg_authid and pg_shdepend (these are the ones I know by heart; I am talking about the tables in the pg_global tablespace).

Running VACUUM (FULL) will also treat these tables, so other databases are affected.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit dba.stackexchange
scroll top