Re: Unsplitting btree index leaf pages - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unsplitting btree index leaf pages
Date
Msg-id 26260.1135282288@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unsplitting btree index leaf pages  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Unsplitting btree index leaf pages  (Kevin Brown <kevin@sysexperts.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> We already do something similar for page deletions.  Empty pages are not
> deleted right away, but they are marked with BTP_DEAD, and then deleted
> on a subsequent vacuum.  Or something like that, I don't remember the
> exact details.

Right, and the reason for that is exactly that there might be a
concurrent indexscan already "in flight" to the newly-dead page.
We must wait to recycle the page until we are certain no such scans
remain.

It doesn't matter whether a concurrent indexscan visits the dead
page or not, *because it's empty* and so there's nothing to miss.
So there's no race condition.  But if you try to move valid data
across pages then there is a race condition.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: WAL bypass for INSERT, UPDATE and DELETE?
Next
From: Bruce Momjian
Date:
Subject: Re: Automatic function replanning