Re: Lock problem with autovacuum truncating heap

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Jan Wieck <JanWieck(at)yahoo(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Lock problem with autovacuum truncating heap
Date: 2011-03-26 19:17:55
Message-ID: D511E9E4-B549-4628-8E98-54CF045DA8F5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mar 26, 2011, at 1:44 PM, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> wrote:
> On Sun, Mar 27, 2011 at 01:12, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>>> At the same time I would
>>> change count_nondeletable_pages() so that it uses a forward scan direction
>>> (if that leads to a speedup).
>
> +1.

Hmm. That would speed up truncations that are large relative to the table size, but slow down small truncations. And small truncations are likely to be more common than big ones.

Maybe we could do a mix... back up 16MB and scan forward; if all those pages are empty then back up 16MB from the start point and scan forward from there. Or whatever we think the right chunk size is to get some benefit from kernel readahead without making the "truncate 1 block" case slow.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2011-03-26 20:05:57 Re: Lock problem with autovacuum truncating heap
Previous Message Robert Haas 2011-03-26 18:11:37 Re: 9.1 Beta