Bastian Balthazar Bux wrote:


#1
I've never used them but this seem a problem that can be solved by ldap databases,
Anyway I've implemented for my website a tree structure for users, based on traditional SQL databases (MySQL).
It uses a varchar to simulate the tree, now it's used for only few thousand users, with a max depth level of 64 but it can be extended to support more.
Quite all operation are done by single query, using recursion is totally avoided (It's the only thing that I can think doing it slower than a filesystem).
One year ago I've thinked about opensourcing it and write a howto, but with a low priority, if you want to translate your application in a database driven one I can give you the software in 2 or 3 days, leave me the time to clean and comment it a bit more.


#2
the only one that permit you to save disk space is reiserfs *avoiding* notail mount option, the overhead for a database structure is minimal


#3
using unique indexes should really be faster, one disk access to the index, one to the data, but only you can evaluate that.


Francesco

--
gentoo-user@gentoo.org mailing list

Well, it seems to me that for every level of the tree, there are 256 leaves, so that corresponds nicely to one byte. So, if you have 8 levels deep, you ought to be able to address ANY leaf on the tree in 8 bytes, or a 64-bit integer. So, with a little simple boolean math and a 64-bit index you have yourself a fast and reasonable database implementation. I won't take the time to analyze storage right now, but it is another simple solution worth looking at.

--
Thomas T. Veldhouse
Key Fingerprint: 07C7 BF05 4176 F50B A083  4542 0118 1315 761F D300
Spammers please contact me at [EMAIL PROTECTED]


-- gentoo-user@gentoo.org mailing list



Reply via email to