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

From Tom Lane
Subject Re: Unsplitting btree index leaf pages
Date
Msg-id 17373.1135210043@sss.pgh.pa.us
Whole thread Raw
In response to Unsplitting btree index leaf pages  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: Unsplitting btree index leaf pages  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> While we scan, if we found two adjacent pages, both of which have less
> than (say) 40% rows, we could re-join or "unsplit" those pages together.

Curiously enough, this has been thought of before.  It is not as easy
as you think, or it would have been done the first time around.
nbtree/README explains why:

: We consider deleting an entire page from the btree only when it's become
: completely empty of items.  (Merging partly-full pages would allow better
: space reuse, but it seems impractical to move existing data items left or
: right to make this happen --- a scan moving in the opposite direction
: might miss the items if so.  We could do it during VACUUM FULL, though.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Unsplitting btree index leaf pages
Next
From: Manfred Koizar
Date:
Subject: Re: Re: Which qsort is used