Re: [PATCH] vacuumlo: print the number of large objects going to be removed

From: Timur Birsh <taem(at)linukz(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] vacuumlo: print the number of large objects going to be removed
Date: 2019-06-14 04:48:41
Message-ID: 1871151560487721@myt3-c7e5d17fe013.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

13.06.2019, 13:57, "Michael Paquier" <michael(at)paquier(dot)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 Content-Type Size
0001-Report-the-number-of-large-objects-going-to-be-remov.patch text/x-diff 2.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Barwick 2019-06-14 06:15:48 [PATCH] Stop ALTER SYSTEM from making bad assumptions
Previous Message Thomas Munro 2019-06-14 04:40:09 Re: ldapbindpasswdfile