durusmail: durus-users: Storing a tree structure in Durus
Storing a tree structure in Durus
2006-06-23
2006-06-24
2006-06-25
Storing a tree structure in Durus
Jesus Cea
2006-06-24
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Damjan wrote:
> Is there a recommended way of storing a tree structure in a Durus
> database? BTW are there any examples of Durus usage, I learn by example
> the best, and I still need to learn a lot. :)

The performance will depend of how many elements you have, the "fanout"
of the tree and the size of each element. And your access pattern.

Without any detail, any suggestion would miss the sweet point.

> I'm building an application in which I have a tree of devices, probably
> the tree will be 3 levels deep (cluster, ap, subscriber). I need to
> iterate through all the devices in the database at regular intervals, then
> update some values for each device. At times, I might need to move a
> device in the tree...

Only three levels?. So I guess you have a lot of nodes for level. Try a
BTree structure, where each element can be another BTree. If your tree
were deeper with less fanout, perhaps a tree of PersistentList or
PersistentDict would be more apropiate.

So, there are not silver bullet without knowing more details.

PS: If your data is small enough to fit in your RAM, the concrete
persistent container used is not very important, since you will be
accessing data at raw python speed, thanks to Durus connection cache.
I'm guessing you have a single data mutator process out there.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea@jabber.org         _/_/    _/_/          _/_/_/_/_/
                               _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRJyMhZlgi5GaxT1NAQIk+AP/Q4sMUwHrERAOZbJckggD0Icw/SY6l+1K
M1FF7/wSLPm6q4BkKehavbztXgmM99ZWxUoCVUeoQPkgiCxgJilVYCrK/iiyw6Fh
ZKydj6iKGsPtOVw7o6Y9sX6LPFdx/cbWX79hx2K+5jiJUYoB1APTbQi5XZgy1yX4
W2aOuJ1heKQ=
=CbW1
-----END PGP SIGNATURE-----
reply