Re: Remove duplicated row in pg_largeobject_metadata

From: Tobias Meyer <t9m(at)qad(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Remove duplicated row in pg_largeobject_metadata
Date: 2021-09-18 17:58:42
Message-ID: CAAEpUZm5Q0FJBPHthjmyzuV4jDHoM251y+-6ViLX1OR1Pt8vGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,
thanks for taking a look.

> hmm ... is this a reasonably up-to-date v10?
>
> PostgreSQL 10.18
The latest packaged with Ubuntu 18.04.

> Delete by ctid.
>
> select ctid, oid, * from pg_largeobject_metadata where oid=665238;
> delete from pg_largeobject_metadata where ctid = 'pick one';
>
> OK, that worked, but it seems there is more than one...

so I did
select ctid as tid,oid,lomowner into temp table temp_pgmeta from
pg_largeobject_metadata;
select * from ( select count(tid) as cnt,max(tid), min(tid), oid from
temp_pgmeta group by oid) x where cnt > 1;

and that gave me 2951857 rows

I admit we have quite a few of LOs in there, around 32 million, where
vacuumlo had already cleaned 47 million in a first run.

And I know this is bad practise, but we forgot to unlink when deleting
things - it's why we needed vacuumlo to begin with.

Any ideas what might have happened?

Kind regards, Tobias

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-09-18 18:28:11 Re: Remove duplicated row in pg_largeobject_metadata
Previous Message Tom Lane 2021-09-18 17:01:48 Re: Remove duplicated row in pg_largeobject_metadata