Can I do vacuumlo,vacuumdb and reindex in live production system without any downtime in postgres database

dba.stackexchange https://dba.stackexchange.com/questions/237522

Question

We are using a Postgres database (9.3) as our production database. It is generating huge lo objects. Due to this, the size is growing very fast. So we need to do database cleaning frequently. To remove these lo objects we are having long downtimes.

To clean the DB, we are performing the below steps in sequence:

  1. vacuumlo database_name

  2. vacuumdb database_name -t pg_largeobject

  3. vacuumdb database_name -t pg_largeobject_metadata

  4. reindexdb -t pg_largeobject database_name

  5. reindexdb -t pg_largeobject_metadata database_name

Can we do the above online (during the night) without having any downtime?

Était-ce utile?

La solution

"reindexdb" takes the most stringently lock, and is the only thing likely to be causing downtime.

Unless you have evidence that it is necessary, just stop doing the "reindexdb". It might be necessary to do it once, in order to get you out of the hole, but shouldn't be necessary to do each time you do "vacuumlo".

Licencié sous: CC-BY-SA avec attribution
Non affilié à dba.stackexchange
scroll top