Re: recursing down a tree - Mailing list pgsql-general

From Curt Sampson
Subject Re: recursing down a tree
Date
Msg-id Pine.NEB.4.44.0207152243290.492-100000@angelic.cynic.net
Whole thread Raw
In response to Re: recursing down a tree  (71062.1056@compuserve.com (--CELKO--))
List pgsql-general
On 12 Jul 2002, --CELKO-- wrote:

> I am writing a separate book on "Trees in SQL" which will cover
> several different models; I hope to be done by the end of the year. I
> also hope to win the lottery.

Are you *the* Joe Celko? "I'm not worthy! I'm not worthy!" :-)
Though I hope you'll let us know when your book comes out.

> Updating is not the problem people think it is.  The nodes are in one
> table and the structure is in another.  The Tree table has (node_id,
> lft, rgt) in its rows and those the rows are very short; a lot of them
> fit into main storage at once.

Unfortunately, this is not such a great assumption for postgres,
unless you otherwise have longish rows. The row overhead is over
40 bytes, including the row pointers in the page (giving you about
150 rows per page, when all is said and done). So with smallish
rows anyway, and depending on the application, and yada yada yada,
you might be better off not using a separate table.

cjs
--
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC


pgsql-general by date:

Previous
From:
Date:
Subject: Re: MySQL vs. PostgreSQL
Next
From: Steve Brett
Date:
Subject: Re: SERIAL behaviour