From: knut.suebert@web.de
To: pgsql-sql@postgresql.org
Subject: Re: tree structures in sql - my point of view (with request of comment from joe celko)
Date: Wed, 4 Sep 2002 19:46:08 +0200
Message-ID: <20020904174608.GA3296@fraxinus.reticulum> (raw)
In-Reply-To: <200209031117.38107.josh@agliodbs.com>
References: <20020903132207.GC24879@depesz.pl>
<200209031117.38107.josh@agliodbs.com>
Josh Berkus schrieb:
> 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.
Hi,
for graphical display it may be (the application to display could do the
work), but displaying data in tables (or tabulars, if you prefer
LaTeX-Syntax) leeds to recursion, I'd say.
> Nested Set trees are hard to wrap your mind around,
Yes ;-)
> 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.
While wrapping around my mind to understand Nested Sets, I got an idea
to speed up the count of subnodes and leaves (expensive if only "lft"
and "rgt" are used) by adding a third field called "lvl".
See
http://www.net-one.de/~ks/WOoK/postmaster.phphttp://www.net-one.de/~ks/WOoK/nset.sql.txt
I wrote something about it here some months ago, got a few PMs with
positive reactions (so I'm writing this) and a correction. Due to time
lack, the 'documents' linked above are still draft, ugly written and
the examples may work or not, sorry.
The idea of "lvl" maybe useless or not? I'm not an expert.
> So which model you use depends on what you intend to do with the tree.
And try to understand Oleg's contrib/ltree. It may be better.
Greetings,
Knut Sübert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: knut.suebert@web.de
Subject: Re: tree structures in sql - my point of view (with request of comment from joe celko)
In-Reply-To: <20020904174608.GA3296@fraxinus.reticulum>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox