Re: Behaviour when autovacuum is canceled

From: Martín Fernández <fmartin91(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Behaviour when autovacuum is canceled
Date: 2018-09-13 23:14:41
Message-ID: 5b9aee4e3f8b8f4e0c000003@polymail.io
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David,

Your last comment applies for cleaning up indexes as well ? We performed a simple test in our production database to understand behaviour and we got a result that surprised us based on your last comment.

We basically started a VACUUM on a given table, waited for one index to process (captured cleaned rows count) and cancel the VACUUM. When we run another VACUUM on the same table the dead rows removed from the first index was a number slightly higher than the value logged on the first VACUUM. This behaviour made us feel that the work done to clean dead tuples on the first index was performed again. 

Thanks!

Martín

On Thu, Sep 13th, 2018 at 8:0 PM, "Martín Fernández" <fmartin91(at)gmail(dot)com> wrote:

>
> David,
>
>
> Thanks a lot for the quick reply. 
>
>
> I clearly misunderstood the references in the code. 
>
>
> Best,
>
> Martín
>
>
> On Thu, Sep 13th, 2018 at 7:55 PM, "David G. Johnston" < david(dot)g(dot)johnston(at)gmail(dot)com
> > wrote:
>
>
>>
>> On Thu, Sep 13, 2018 at 3:45 PM, Martín Fernández < fmartin91(at)gmail(dot)com > wrote:
>>
>>
>>> From what I could understand (that can be totally wrong), the vacuum
>>> process is split in multiple small transactions. If the autovacuum is
>>> canceled, could it be possible that only the latest transaction work be
>>> lost 
>>>
>>
>>
>>
>> From the docs:
>>
>>
>> "VACUUM cannot be executed inside a transaction block."
>>
>>
>> As it is non-transactional any work it performs is live immediately and
>> irrevocably as it occurs.
>>
>>
>> David J.
>>
>>
>>
>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neto pr 2018-09-13 23:55:24 Re: [External] RE: Estimate time without running the query
Previous Message Adrian Klaver 2018-09-13 23:10:22 Re: Slow shutdowns sometimes on RDS Postgres