Batch the loading of metadata during entity list rendering
|Reported by:||mrclay||Owned by:||mrclay|
|Severity:||minor||Keywords:||metadata, performance, optimization|
Description (last modified by ewinslow)
When displaying a list of entities, particularly of the same type/subtype, it would be wise to attempt to autoload a metadata key for all entities in the list whenever an unloaded key is requested.
E.g. elgg_list_entities is asked to render some blog posts. In the first view rendering, $entity->foo was already pre-loaded (by some other mechanism) but $entity->bar has not been. This, I think, makes it extremely likely that that bar is going to be needed for all entities in the list, so they all should be loaded at that time in as few queries as possible.
In practice, something like the context stack would be needed, but holding lists of entities being currently rendered (and a comma-separated list of their GUIDs for use in queries).
What I imagine complicates batch-loading metadata is that some entities could have bar as an int, some others as an array of strings, etc. but I imagine there's still big opportunity for reducing queries.
Change History (19)
comment:2 Changed 13 months ago by ewinslow
- Description modified (diff)
- Milestone changed from Needs Review to Near Term Future Release
comment:14 Changed 12 months ago by ewinslow
- Milestone changed from Near Term Future Release to Elgg 1.9.0
comment:16 Changed 10 months ago by Steve Clay
- Resolution set to fixed
- Status changed from assigned to closed