Re: [PATCH] vacuumlo: print the number of large objects going to be removed - Mailing list pgsql-hackers

From Timur Birsh
Subject Re: [PATCH] vacuumlo: print the number of large objects going to be removed
Date
Msg-id 1871151560487721@myt3-c7e5d17fe013.qloud-c.yandex.net
Whole thread Raw
In response to Re: [PATCH] vacuumlo: print the number of large objects going to beremoved  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [PATCH] vacuumlo: print the number of large objects going to beremoved
List pgsql-hackers
13.06.2019, 13:57, "Michael Paquier" <michael@paquier.xyz>:
> On Thu, Jun 13, 2019 at 01:25:38PM +0600, Timur Birsh wrote:
>>  Just to be sure, a new command line argument needs to be added for
>>  reporting the numbers? Should it implies --verbose argument?
>
> Nope. I mean that running a SELECT count(*) can be costly for many
> items.

Understood, thanks.

I found a way to get the number of LOs that will be removed without
the SELECT count(*) - PQcmdTuples(). Please find attached patch v2.
I fixed some indentation in the variable declaration blocks.

There is a database with tables that have a lot of tuples with large objects:

# select count(*) from pg_largeobject_metadata;
  count
----------
 44707424
(1 row)

An application that uses this database from time to time deletes and adds a lot
of rows, it happens that more than 10,000,000 orphaned LOs remain in the
database. Removing such a number of items takes a long time.
I guess, it would be helpful to know how many LOs going to be removed and
report deleted percentage.

Thanks,
Timur
Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: ldapbindpasswdfile
Next
From: Ian Barwick
Date:
Subject: [PATCH] Stop ALTER SYSTEM from making bad assumptions