<p><pre><code> The database operations on the nested data were
just taking too much processing power.
</code></pre>
Given that this is Rails, and given that it's certainly SQL involved here, I just have to ask (and I know the answer is probably "yes") -- did you try implementing nested sets?<p>I ask because my experience has been that nested data is (with the kinds of nested data I've been handed, anyway) not a performance problem. Selects and updates of nested data can be as responsive as any range query on flat data, and when it comes to managing the performance of inserting new nodes, deleting or moving subtrees, there are a lot of options depending on what you want to optimize for (like spreading out the range from 1 to the max integer supported and periodically re-packing; that way, inserting leaves and any kind of deletion is as fast as with flat data).<p>I'm curious about what your nested data looked like. Sorry to get distracted on a minor point, but I'm intrigued! When I'm developing, I just always <i>feel</i> as though I should only worry when I start seeing data that has to be a graph and can't be represented as a tree, but as long as it actually <i>is</i> hierarchical then I won't have to worry about speed too much; but now I'm wondering if that intuition will bite me.