True, but no matter what your choice of optimization, you will have a
snag.  You will be doing more reads than writes, and you will be doing
an in-table mathematic transformation (set LFT=LFT+1 or RGT=RGT+2 for
all rows whose left exceeds the newly inserted one...) That's linear,
but IMHO well worth it...

Check http://www.intelligententerprise.com/001020/celko1_1.jhtml,
someone already wrote an import query from adjacency list (which is what
everyone's used to -- row points to parent row) into this app.

<Disclaimer message="this might not make sense">I've never done this,
but I'm sure you can avoid re-balancing your tree if you assign LFT,RGT
values in increments of 100 (remember good old' prodos BASIC from my
early apple childhood). This way a single insert won't force a
rebalance. (you'd insert parent.LFT+1, and have for your children, all
numbers between parent.LFT+2 until your sibling's LFT, or your parent's
RGT (if you are an only child)... It would complicate things, but slow
down your update rate...</Disclaimer>

-Dov

-----Original Message-----
From: Ian Buzer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 23, 2004 8:51 AM
To: CF-Talk
Subject: Re: In One?

>You could set your table up in a "modified preorder tree traversal", so

>each node has a "LFT" and "RGT" numeric value. I've done this in 
>several instances and it works great.

Hey, thanks Dov, that's lovely.

As far as I understand it so far, it does have the snag that if you make
a change near the top of the hierachy, a whole lot of data below has to
be updated.

Also, in this particular instance, I'm importing the category heirachy
from another app on a daily basis which uses the other schema, so I'm
probably looking at a long process to convert it from one schema to
another during the import.

Ian



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188646
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to