I urge you to avoid doing that.

Lets say you have a 3000 node tree, evenly distributed looking something
like this:

  A 
 B C
DE FG
...
Thousands/hundreds of nodes under here

If you , say want to insert B2, between A and B, you have to update the
varchar/text "path" column for several thousand nodes, (all of B's
ancestry) which by its datatype (varchar/text), and number of updates
can be very costly.  (text, linear, at worst)

----

Alternatively if you do it using modified preorder tree traversal, you
would be making numeric updates in order to do the same.   (numeric,
linear, at worst)

----

Granted, both of these are the costs of precomputing "helper" data to
avoid recursing every time you need to find out the structure and paths
of arbitrary nodes, but if you are going to do either, I suggest the
latter.

-Dov




-----Original Message-----
From: Aaron DC [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 23, 2004 7:59 AM
To: CF-Talk
Subject: Re: In One?

Is varchar fixed in size? If so the field would not satisfy an arbitrary
depth of hierarchy. By "dynamically-sized text field" I mean any field
type that allows an "unlimited" dynamic length of text, like the memo
field in MS Access or DBISAM and is a generic description of what I
meant. Apply as you see fit to your db of choice!

Varchar in MySQL (255 chars max) is very different to Varchar in MS SQL
Server (4000 chars max).

I guess more than anything I'm struggling with someone saying that they
dont understand what I'm suggesting then telling me "here's how to make
it better". Ah well. Hope your cough clears up, and Merry Christmas :-)

Aaron

----- Original Message -----
From: "Micha Schopman" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Thursday, December 23, 2004 9:24 PM
Subject: RE: In One?


> "You could always cheat and have a dynamically-sized text field 
> containing a comma separated list of the parentCategoryID hierarchy
:)"
>
> *cough* I think I misunderstood this suggestion ;) Even then, varchar 
> would be a better choice :P
>
> Micha Schopman
> Software Engineer





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:188627
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