Re: Brain dump: btree collapsing

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: Brain dump: btree collapsing
Date: 2003-02-14 16:30:56
Message-ID: 7805.1045240256@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:
> Given that we have a mostly empty metapage per index, and the metapage
> is in memory most of the time, using it for the freelist looks almost
> like a free lunch.

No, because of locking. Every time you write-lock the metapage to add
or remove freelist entries, you are denying all other processes the
ability to start an index scan. Check the btree literature ---
exclusive locks near the root of the tree are death for concurrent
performance, and must be avoided as much as possible.

If I were planning to use a freelist I would keep it in a different page
so as not to need to lock the metapage for freelist manipulations. But
I don't see the value of having one at all. It just adds that much more
disk traffic (and WAL traffic) for each page split or merge. There are
also atomicity concerns --- is addition/removal of a freelist entry an
atomic part of the page merge or split operation, or is it a separate
atomic operation with its own WAL record? If the former, you have
deadlocking problems; if the latter, post-crash-consistency problems.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-02-14 16:32:02 Re: psql and readline
Previous Message Tom Lane 2003-02-14 16:19:56 Re: Brain dump: btree collapsing