From: Daniel Verite <daniel@manitou-mail.org>
To: Jim Hurne <jhurne@us.ibm.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: RE: autovacuum failing on pg_largeobject and disk usage of the pg_largeobject growing unchecked
Date: Tue, 23 Jun 2020 00:00:37 +0200
Message-ID: <0e1db9da-a9c2-4555-9202-d88c4edc8e18@manitou-mail.org> (raw)
In-Reply-To: <OF6F76F708.753D5B4C-ON8525858F.00625B6E-8525858F.006DF3EF@notes.na.collabserv.com>
Jim Hurne wrote:
> We are of course going to continue to try different things, but does
> anyone have any other suggestions on what we should be looking at or what
> settings we might want to adjust?
If you can arrange a maintenance window, a faster way to rebuild
pg_largeobject when it contains mostly empty pages can be to:
- export the contents into files:
for id in select oid from pg_largeobject_metadata
loop
perform lo_export(id, '/tmp-path/'||id::text);
end loop;
- SET allow_system_table_mods to ON; (needs a restart)
- truncate table pg_largeobject, pg_largeobject_metadata;
- reimport the files with the same OIDs
for id in select pg_ls_dir('/tmp-path/')
loop
perform lo_import('/tmp-path/' || id::text, id::oid);
end loop;
- remove the files in /tmp-path
- Set allow_system_table_mods back to OFF and restart again, unless
you don't need that safety check and prefer to leave it permanently to ON
to avoid the restarts.
With less than 60MB of actual contents, all this might take no more
than a few minutes, as these operations don't need to fully scan
pg_largeobject, which is what is problematic with vacuum.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, jhurne@us.ibm.com
Subject: Re: autovacuum failing on pg_largeobject and disk usage of the pg_largeobject growing unchecked
In-Reply-To: <0e1db9da-a9c2-4555-9202-d88c4edc8e18@manitou-mail.org>
References: <OF6F76F708.753D5B4C-ON8525858F.00625B6E-8525858F.006DF3EF@notes.na.collabserv.com> <0e1db9da-a9c2-4555-9202-d88c4edc8e18@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox