Re: autovacuum truncate exclusive lock round two

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: autovacuum truncate exclusive lock round two
Date: 2012-10-25 13:57:38
Message-ID: 50894552.4060804@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/25/2012 9:45 AM, Tom Lane wrote:
> Jan Wieck <JanWieck(at)Yahoo(dot)com> writes:
>> On 10/24/2012 10:46 PM, Stephen Frost wrote:
>>> Would it be possible to use the FSM to figure out if things have changed
>>> since the last scan..? Does that scan update the FSM, which would then
>>> be updated by another backend in the event that it decided to write
>>> something there? Or do we consider the FSM to be completely
>>> untrustworthy wrt this (and if so, I don't suppose there's any hope to
>>> using the visibility map...)?
>
>> I honestly don't know if we can trust the FSM enough when it comes to
>> throwing away heap pages. Can we?
>
> No. Backends are under no obligation to update FSM for each individual
> tuple insertion, and typically don't do so.
>
> More to the point, you have to take AccessExclusiveLock *anyway*,
> because this is interlocking not only against new insertions but plain
> read-only seqscans: if a seqscan falls off the end of the table it will
> be very unhappy. So I don't see where we'd buy anything by consulting
> the FSM.

Thank you.

One thing that I haven't mentioned yet is that with this patch, we could
actually insert a vacuum_delay_point() into the loop in
count_nondeletable_pages(). We no longer cling to the exclusive lock but
rather get out of the way as soon as somebody needs the table. Under
this condition we no longer need to do the second scan full bore.

Jan

--
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2012-10-25 14:12:01 Re: autovacuum truncate exclusive lock round two
Previous Message Kevin Grittner 2012-10-25 13:53:16 Re: WIP fix proposal for bug #6123