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"