Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DC909476091 for ; Tue, 3 Sep 2002 14:17:53 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 4919D475DC2 for ; Tue, 3 Sep 2002 14:17:53 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1632078; Tue, 03 Sep 2002 11:17:52 -0700 Content-Type: text/plain; charset="iso-8859-2" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: depesz@depesz.pl, pgsql-sql@postgresql.org Subject: Re: tree structures in sql - my point of view (with request of comment from joe celko) Date: Tue, 3 Sep 2002 11:17:38 -0700 X-Mailer: KMail [version 1.4] References: <20020903132207.GC24879@depesz.pl> In-Reply-To: <20020903132207.GC24879@depesz.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200209031117.38107.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/15 X-Sequence-Number: 9292 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= =20 tools on freshmeat.net for them, and they are the most efficient form of tr= ee=20 for graphical display. Nested Set trees are hard to wrap your mind around, lack a lot in the way o= f=20 code samples on freshmeat, are harder to build GUI tools for, but are much,= =20 much faster for determining branch membership and branch parenthood. So which model you use depends on what you intend to do with the tree. --=20 -Josh Berkus Aglio Database Solutions San Francisco