Re: B-tree fan-out

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: cluster <skrald(at)amossen(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: B-tree fan-out
Date: 2007-06-23 15:27:02
Message-ID: 20070623152702.GC11248@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 23, 2007 at 04:11:52PM +0200, cluster wrote:
>
> >In postgres, everything is done in pages, so how ever many keys fit in
> >a page. Bigs keys mean less. For integers you can fit an awful lot of
> >keys.
> OK, interesting. Does that mean, that when a node containing only small
> values (e.g. integers) is split, then it gets an awful lot of child nodes?

No, when you split a page it gets split in two, with each page getting
half the keys of the old one. This is independant of the size of the
keys. (This is also why a key is limited to 1/3 page size, so you can
always split a page into two smaller ones.)

In any case, I think the answer to your original question is that the
fan-out can be up to several hundred per level, but it's not fixed.

> >>In B-trees all non-leaf nodes have a bunch of pointers to its child
> >>nodes. What is the size of such a pointer?
> >I imagine it's a page number, probably just a 32-bit integer.
> >
> OK, thanks a lot. Do you know if other database systems implement
> b-trees this way too? I.e. one page per node.

No idea whatsoever.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message cluster 2007-06-23 15:58:51 Re: B-tree fan-out
Previous Message Joris Dobbelsteen 2007-06-23 14:28:56 Re: Proposed Feature