pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrien NAYRAT <adrien.nayrat@anayrat.info>
To: Andrey Zhidenkov <andrey.zhidenkov@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: Can long-running VACUUM be interrupted?
Date: Tue, 20 Nov 2018 09:05:17 +0100
Message-ID: <039bd8a3-bae5-cdee-e310-b53112f2086f@anayrat.info> (raw)
In-Reply-To: <CAJw4d1UKbCZjP6vUTkDJZAouWazN3nX6zgn_Meg+EWZisaL2-w@mail.gmail.com>
References: <CAJw4d1UKbCZjP6vUTkDJZAouWazN3nX6zgn_Meg+EWZisaL2-w@mail.gmail.com>

On 11/20/18 4:58 AM, Andrey Zhidenkov wrote:
> I have long-running prevent wraparound VACUUM (it has been running for
> 6 days at the moment). The question is: if I interrupt this process in
> some way (restart database, for instance), will it start from the
> beginning? On the one hand, it opens a new transaction at the
> beginning (according to the source code), on the other hand it updates
> some data on the disk (WAL?). It confuses me. Could someone please
> explain me this?
> -
> With best regards, Andrey Zhidenkov
> 

Hi Andrez,

You could interrupt with pg_cancel_backend function, but autovacuum will 
restart after autovacuum_naptime delay (1min by default).

If you are 9.6+, Postgres will be able to skip already frozen row on the 
table, but it will scan all indexes from the beginning.

Why do you want to interrupt? This kind of vacuum is necessary to avoid 
wraparound: 
https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND


Regards,




view thread (2+ messages)

Message-ID: <039bd8a3-bae5-cdee-e310-b53112f2086f@anayrat.info>
Permalink:  ../039bd8a3-bae5-cdee-e310-b53112f2086f@anayrat.info/
Also on:    postgresql.org/message-id/039bd8a3-bae5-cdee-e310-b53112f2086f@anayrat.info

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: adrien.nayrat@anayrat.info, andrey.zhidenkov@gmail.com
  Subject: Re: Can long-running VACUUM be interrupted?
  In-Reply-To: <039bd8a3-bae5-cdee-e310-b53112f2086f@anayrat.info>

* 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