Hierarchical Data Storage
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Feb 12 02:57:30 CST 2007
On 12/2/07 10:46 AM, "Bart Pietercil" <bart.pietercil at gmail.com> wrote:
Hi Bart,
>> actually find direct children is as easy as
>>
>> WHERE parentPtr = somevalue
>
> That's what I mean, in the preorder tree model I don't need a
> parentPtr .
> I can find the first left child by doing WHERE leftfield =
> (current_leftfield + 1), but I need to always walk through the
> results of the query (give_descendants) to find more possible direct
> children.
>
> But by using a parentPtr I can use WHERE parentPtr = my_own_recid.
> But parentPtr is if you want "part" of the recursive model.
>
> So we are using mixed mode. I think we will have great speed with the
> mixed model.
I see idea.
> Of course having binary hierarchical is the ideal solution, because
> as you said, the update and insert routines that for now are
> "dangerous" (rebuilding all descendants could mean lock on entire
> table) could be handled internally maybe even without locking the
> table (the "left' and 'right' would be part of the link not of the
> table correct ?)
I recommend you try do
SqlExecute( "UPDATE .. ; UPDATE ... ;" )
I.e. Both commands inside of single call to server.
This will execute them without give control to other users.
> Can this be made for 3.0 ? :-)
Not for 3.0, but for 3.x possible.
> Thinking about this, I would say that the mixed model is the model to
> implement, so this would be a marriage between recursive model AND
> (not OR) preorder tree traversal
> Binary Hierarchical uses pointer (= recursive model) for children and
> uses seq_left and seq_right for querying the complete hierarchy.
We need think and think here. Theme is wide.
I have pickup SQL99 book, and see present few pages on SQL and hierarchy
calls in SQL99. Need to re-read that also.
-------
point:
Article describe that all this (id, right, left) fileds which establish
hierarchy link are inside of T1 itself.
My vision of Hieararchy Binary Link is -- that it should be in behind table
with this fields. So in fact you have:
Table T1 (productName)
Table of Link (parentPtr, childPtr, left, right)
So this "link fields" are extracted from YOUR TABLE to make design more
clean.
MAY BE you can self implement this way...
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list