24 Feb 2003 obi   » (Journeyer)

amars:

I don't know if it really solves the problem you're having, but you can try to deal with the problem by using the so-called "nested set model".

It's much faster to SELECT all the results you want (you need only one select for a node including all its children (several levels deep), any way you want). But there's a cost when inserting a node: you need to update all the numbers yourself that get affected by the insert. So this model is good when you read alot, but don't write as much.

Other nice properties is that its extremely easy to count the number of nodes in a (sub)tree, find a level, do a "group by", etc.

As always it's a tradeoff. Check: this link or search google for "worm tree sql" or "nested set model"

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!