Hierarchical Data Storage

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Feb 11 03:02:08 CST 2007


On 10/2/07 9:02 PM, "Bart Pietercil" <bart.pietercil at gmail.com> wrote:

> Hi List,
> 
> as I'm new to the features of Valentina, I post this question to
> ascertain that I'm on the right track.
> 
> The subject says it all: are there in the feature set of Valentina
> things I should now when storing hierarchical data?
> 
> The model is a company with loosely defined departments (cells in our
> db). The cells are just groups of people, but that's not really
> relevant for the discussion.
> 
> What I would go for in a relational model is described here:
> 
> http://www.sitepoint.com/article/hierarchical-data-database/2
> 
> 
> However the model described in aforementioned page(the modified
> preorder tree traversal storage method) to me has very high
> resemblance with the network-model database described in Valentina's
> documentation ( intro to the databasemodel)
> Further down is noted that the Link abstraction model (re) introduces
> the network model for Valentina.
> 
> Now I don't really see if working with links would bring an advantage
> to the modified preorder tree traversal storage method, but I might
> be overlooking something.
> 
> The goal must be : one query to obtain all ascendant ID's, one query
> to obtain all descendants ID's. ( A manager of a cell is also manager
> of the subordinate cell's personnel. So when he says show me all
> (from all cells) my personnel status, I want to be able to obtain all
> cell id's with one query (not using recursion), at least until
> someone comes up with a better way that is :-)

I have read this article completely. Its new idea for me to use 2 integer
columns to improve things!

At morning I have next thoughts:

* we have BinaryLink - okay.

* we can introduce its sub-class
          HierarchyBinaryLink

* so developer make table T1 with only ONE field (following example of
article) 

        T1 ( productName, and of course more fields can be, ... )

And now establish self-recursive HierarchyBinaryLink

    CREATE HIERARCHY BINARY LINK link_name (T1)
        USING { LIST | PREORDER }

So this class HierarchyBinaryLink will implement both ways.
Will contains algorithms and data outside of T1.

    It seems to me just COOL.  :-)

Then we can make some specific methods on API level and of course on SQL
level to work with this link.

I think this theme is very closed to idea of VCursorHierarchy which we also
plan to implement. It should return not flat table, but really hierarchy
information. 


---------
Another good point here.

Even if you self will implement preorder tree on Valentina 2.5.5
You will get much faster speed of updates

    UPDATE ...  Left = left + 2

Because this is operation on separate column, and Valentina keep fields by
columns, so you win > N times (when N is number of fields in table).


-- 
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