From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: AW: running vacuumlo periodically?
Date: Fri, 29 Jan 2021 10:24:18 +0100
Message-ID: <7ab85369ae7d01b21f780d04be2bc2fe22624b5f.camel@cybertec.at> (raw)
In-Reply-To: <7bd95c7b8c5d451c9c1cac538984ea0b@zuerich.ch>
References: <f4341d00740f4e20bd67041049788c82@zuerich.ch>
<0c6514ab0ef287b40e818280754d087d210a0164.camel@cybertec.at>
<7bd95c7b8c5d451c9c1cac538984ea0b@zuerich.ch>
On Thu, 2021-01-28 at 17:03 +0000, Zwettler Markus (OIZ) wrote:
> We didn't recognize that an application is using large objects and didn't delete them.
> Now we found >100G dead large objects within the database. :-(
>
> Is there any _GENERIC_ query which enables monitoring for orphaned objects (dead LO)?
>
> select oid from pg_largeobject_metadata m where not exists
> (select 1 from ANY_EXISTING_TABLE_WITHIN_THE_DATABASE where m.oid = ANY_COLUMN_CONTAINING_OIDs);
>
> check_postgres.pl doesn't have any generic check for it. :-(
You'll have to examine the application and see which tables reference the
large objects. Looking for columns with type "oid" will help.
I recommend that you add an "ON UPDATE OR DELETE" trigger that unlinks
orphaned large objects.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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: laurenz.albe@cybertec.at, Markus.Zwettler@zuerich.ch
Subject: Re: running vacuumlo periodically?
In-Reply-To: <7ab85369ae7d01b21f780d04be2bc2fe22624b5f.camel@cybertec.at>
References: <f4341d00740f4e20bd67041049788c82@zuerich.ch> <0c6514ab0ef287b40e818280754d087d210a0164.camel@cybertec.at> <7bd95c7b8c5d451c9c1cac538984ea0b@zuerich.ch> <7ab85369ae7d01b21f780d04be2bc2fe22624b5f.camel@cybertec.at>
* 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