Skip to content

DBAzine.com

Sections
Personal tools
Seeking new owner for this high-traffic DBAzine.com site.
Tap into the potential of this DBA community to expand your business! Interested? Contact us today.
Who Are You?
I am a:
Mainframe True Believer
Distributed Fast-tracker

[ Results | Polls ]
Votes : 3554
 

Comment

Above in this comment thread: Trees in SQL: Nested Sets and Materialized Path

ints too small

Posted by sandfly at 2006-03-03 09:25 AM
This is an interesting idea, but it has problems. If we write out the rational number as a binary fraction, we can see that you are basically encoding the path as sequences of binary zeros, and the 'dots' are the ones: node 2.3.2.1 would encode as:
0.01001011
and the path is: x2xx3x21
This implies the sum of the node numbers equals the number of binary digits required to express the numerator. Clearly you are going to run out if you use a normal 32 or 64 bit int. In this sense it has the same problems as chelko's proposal.

For run, I analysed our portfolio hierarchy. We would need 115 bits to represent the numerator for 2344 portfolios.

ints too small - I agree!

Posted by innovate2000 at 2006-03-03 06:27 PM
I'm new to this and I am trying feverishly to learn.
I was all excited to find this article as I thought it would help me with my large heirarchies - until I saw this post. I did some tests and it seems that the maximum number of elements in the heirarchy cannot exceed 1023 (zero based - using 8 bit numbers). Has anyone come up with a viable solution for this? I would rather not be forced to cap my levels to 20 with no more than 51 elements each. I know that 20x51 is not really efficient in real life applications (or is it?), but I would like the option if I indeed do come across a heirarchy with limits higher than those.

see article:

Posted by innovate2000 at 2006-03-03 11:51 PM
SIGMOD Record, Vol. 34, No. 2, June 2005: Nested Intervals Tree Encoding in SQL (http://www.sigmod.org/sigmod/record/issues/0506/p47-article-tropashko.pdf)

 
Transaction Management
Reduce downtime and increase repeat sales by improving end-user experience.
Free White Paper
Database Recovery
Feeling the increased demands on data protection and storage requirements?
Download Free Report!
 
 

Powered by Plone