datamapper/dm-is-tree — Issue #8: Eager Load entire tree?
Author: mltsy
Created: 2012-03-02 19:35:27+00:00
State: open

I've got a page where I need to display all elements in a table, and it just takes forever to load, partly because it issues a separate query to retrieve each node's children. I imagine it would go much faster to load all the rows at once, and then associate them based on their parent_ids. This, of course, isn't a good solution if you need to load only 10% of a large table, and there's no way to determine which rows need to be loaded without checking for parent_ids one query at a time.

To solve that it might be a good idea to setup something like "eager-loading sets" where you could tag each instance with a set name, so you could eager load a named set... or something.

But for starters, just eager loading the whole table would be awesome.