Re: tree structures in sql - my point of view (with request of comment from joe celko)

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: depesz(at)depesz(dot)pl, pgsql-sql(at)postgresql(dot)org
Subject: Re: tree structures in sql - my point of view (with request of comment from joe celko)
Date: 2002-09-03 18:17:38
Message-ID: 200209031117.38107.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hubert,

> i recently spent some time on tree-structures in sql.
> i started with simple id/parent_id approach, used by nearly everyone,
> then i stopped at joe celko's nested sets, but i found it not very
> usable.

I'll be posting an article on implementing nested set trees "real soon now".

My experieince:

Adjacency list trees are easier to understand conceptually, there are more
tools on freshmeat.net for them, and they are the most efficient form of tree
for graphical display.

Nested Set trees are hard to wrap your mind around, lack a lot in the way of
code samples on freshmeat, are harder to build GUI tools for, but are much,
much faster for determining branch membership and branch parenthood.

So which model you use depends on what you intend to do with the tree.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-09-03 18:39:09 Re: UPDATE & LIMIT together?
Previous Message alexandre :: aldeia digital 2002-09-03 18:05:41 Outer Join with For Update