Re: Allow single table VACUUM in transaction block

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, Peter Geoghegan <pg(at)bowt(dot)ie>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allow single table VACUUM in transaction block
Date: 2022-11-21 15:07:25
Message-ID: CANbhV-G4U08ne=9jY-Lp-4Ph1SQee9he3i7caC=OFUwvMeoROw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 18 Nov 2022 at 11:54, Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com> wrote:
>
> On Thu, 17 Nov 2022 at 20:00, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> >
> > On Wed, Nov 16, 2022 at 05:14:07PM -0500, Greg Stark wrote:
> > > I think this requesting autovacuum worker should be a distinct
> > > command. Or at least an explicit option to vacuum.
> >
> > +1. I was going to suggest VACUUM (NOWAIT) ..
>
> Yes, I have no problem with an explicit command.
>
> At the moment the patch runs VACUUM in the background in an autovacuum
> process, but the call is asynchronous, since we do not wait for the
> command to finish (or even start).
>
> So the command names I was thinking of would be one of these:
>
> VACUUM (BACKGROUND) or VACUUM (AUTOVACUUM) - which might be clearer
> or
> VACUUM (ASYNC) - which is more descriptive of the behavior
>
> or we could go for both
> VACUUM (BACKGROUND, ASYNC) - since this allows us to have a
> BACKGROUND, SYNC version in the future

Attached patch implements VACUUM (BACKGROUND).

There are quite a few small details to consider; please read the docs
and comments.

There is a noticeable delay before the background vacuum starts.

--
Simon Riggs http://www.EnterpriseDB.com/

Attachment Content-Type Size
background_vacuum.v3.patch application/octet-stream 13.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2022-11-21 15:14:07 Re: Damage control for planner's get_actual_variable_endpoint() runaway
Previous Message Tom Lane 2022-11-21 15:01:15 Re: Damage control for planner's get_actual_variable_endpoint() runaway