When my company irenovate was still in business (stupid stock market
crash!!!) we had a fairly large nested tree (about a 1000 nodes). We
were using a modification of dinowitz's <cf_maketree> to reorder it,
then we put the tree into an application variable which we queried off
of using structfind() etc.
Anyway, let me say this.... it was a MAJOR MAJOR pain in the ass, and it
was slow as hell.
We did about 10,000 times more selects than we did
inserts/updates/deletes. I think this would hold true with almost any
tree regardless of size. So in my mind getting a performance boost with
the selects is far more critical.
To select and reorder a 1000 node tree using cf_maketree took like 2000
ms. With the nested set model we could probably do the same size tree
in 20ms. Granted I'm still new to this model, I've only started using
it about a week ago, so I don't have a hell of a lot of experience with
it yet, but so far it's working great to manage this tree:
http://www.secretagents.com/tools/viewlets/
Steve Nelson
http://www.SecretAgents.com
Tools for Fusebox Developers
(804) 825-6093
BORKMAN Lee wrote:
>
> Hey Steve, very cool.
>
> I'm trying to figure out if I like the Nested Trees or the animated
> tutorials better.
>
> Getting off the topic of CF (and esp. of FuseBox), the Nested Trees model
> seems to offer huge benefits in extracting meaningful hierarchical data, but
> at a large cost when INSERTing, DELETEing and otherwise re-arranging the
> tree.
>
> Have you (or any of us) any real-world tales about the pros and cons of
> these trade-offs?
>
> Basically, I have always built my hierarchies as with each node pointing to
> its parent. I guess that's the "adjacent list" method? This is
> conceptually simple, but can be a real bastard when trying to extract, say,
> an ordered list of ancestors. The recursive SQL is just never as elegant as
> the pure Platonic form ;-)
>
> Should I be re-thinking my whole data structure? Say Yes at your peril.
>
> Nice work once again, Steve
> Lee (Bjork) Borkman
> http://bjork.net ColdFusion Tags by Bjork
>
> btw, can you START a message with "btw"?
>
> -----Original Message-----
> From: Steve Nelson [mailto:[EMAIL PROTECTED]]
>
> btw, I did a killer series (if I do say so myself) ;) on Joe Celko's
> "Nested Set Model" from SQL for Smarties. This is something even the
> gurus can learn from.
>
> These tutorials will make sense of that ever annoying problem of "How do
> you deal with nested trees in a database?"
>
> ....
>
> IMPORTANT NOTICE:
> This e-mail and any attachment to it is intended only to be read or used by
> the named addressee. It is confidential and may contain legally privileged
> information. No confidentiality or privilege is waived or lost by any
> mistaken transmission to you. If you receive this e-mail in error, please
> immediately delete it from your system and notify the sender. You must not
> disclose, copy or use any part of this e-mail if you are not the intended
> recipient. The RTA is not responsible for any unauthorised alterations to
> this e-mail or attachment to it.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists