Re: How many levels a B-tree has?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Cris <cris(at)dmcid(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: How many levels a B-tree has?
Date: 2003-05-15 01:27:41
Message-ID: 4597.1052962061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> On Wed, May 14, 2003 at 12:42:17PM -0400, Tom Lane wrote:
>> In CVS tip we keep track of that information in the index's metapage
>> (page zero). But in so-far-released versions it's not explicitly
>> tracked anywhere. You'd have to actually chase down the tree from the
>> root to a leaf to count the levels.

> Does this level count takes into consideration the fast root of the
> tree? I think it doesn't.

IIRC we store the levels of both the true root and the fast root in
the metapage.

> If this is so, the number of disk accesses will be overestimated by
> reading only the level count. One should traverse levels down from the
> true root to the fast root and substract that from the level count.

You're correct, the fast-root level is the interesting one for
performance estimates.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-05-15 02:02:57 Re: fomatting an interval (resend)
Previous Message Kathy Zhu 2003-05-15 00:56:19 postgres.jar