Odd VACUUM behavior when it is expected to truncate last empty pages

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Odd VACUUM behavior when it is expected to truncate last empty pages
Date: 2011-08-03 10:35:43
Message-ID: CAL_0b1sQytEusUSnY3Wv=Wh4MePof15TTA0KDKyuNaX_9YRmAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi all,

I have PostgreSQL 9.0.3 installed on my Gentoo Linux box. The
configuration is default. There is no any activity in the database but
the described below.

What I am trying to achieve is the effect described in this article
http://blog.endpoint.com/2010/09/reducing-bloat-without-locking.html.
In short I am updating last pages of a table to move the tuples to the
earlier pages to make VACUUM able to truncate the empty tail. However
I faced a strange VACUUM behavior. So the situation is:

1. do some UPDATEs on the table so it has several last pages free,
2. perform VACUUM of this table the 1st time, no tail pages will be
truncated (why?),
3. perform VACUUM the 2nd time straight after the 1st one and it will
truncate the tail pages (why this time?).

The case is stable.

Could anybody explain why it could happen, please?

Here is the VACUUMs verbose http://pastebin.com/RjuDmabV

--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray(dot)ru(at)gmail(dot)com / Skype: gray-hemp

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2011-08-03 14:03:05 Re: Vacuum as "easily obtained" locks
Previous Message Michael Graham 2011-08-03 09:47:24 Vacuum as "easily obtained" locks

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-08-03 10:40:42 Re: Further news on Clang - spurious warnings
Previous Message Peter Geoghegan 2011-08-03 10:05:52 Re: Further news on Clang - spurious warnings