Re: Think I see a btree vacuuming bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Think I see a btree vacuuming bug
Date: 2002-05-27 17:48:43
Message-ID: 14310.1022521723@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manfred Koizar <mkoi-pg(at)aon(dot)at> writes:
> On leaf pages order index tuples by heap item pointer, if otherwise
> equal. In IndexScanDescData remember the whole index tuple (including
> the heap item pointer) instead of ItemPointerData. Then depending on
> scan direction _bt_next() would look for the first index tuple greater
> or less than currentItem respectively.

Doesn't help, I fear. Finding your place again is only one part
of the problem. The other part is being sure that VACUUM won't delete
the heap tuple before you get to it. The interlock at the index stage
is partly a proxy to protect heap tuples that are about to be visited
by indexscans (ie, indexscan has read an index tuple but hasn't yet
acquired pin on the referenced heap page).

> (+) btinsert knows, where to insert a new tuple, even if there are
> lots of duplicates (no random())

This is not a (+) but a (-), I think. Given the current CVS tip
behavior it is better for a new tuple to be inserted at the front of
the series of matching keys --- in unique indexes this allows repeated
updates without degrading search time. We are not currently exploiting
that as much as we should --- I suspect btree insertion should be more
willing to split pages than it now is.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darren Johnson 2002-05-27 18:44:17 Re: Replication status
Previous Message Henrik Steffen 2002-05-27 17:27:05 Re: Invalid length of startup packet