I have a view which uses search_api (and solr) to get a list of nodes, and then displays selected fields, including some from a relationship to commerce_product
This is resulting in about a thousand database queries to display about 20 nodes, which I think is inefficient.
Digging in further, it looks like search_api returns a list of nids, which are then loaded with a single invocation of entity_load (which causes several DB queries as field_attach_load loads each of the bundle's fields in turn, loading values for all nodes at once)
But when it comes to the commerce_products in the relationship, these are loaded one-by-one somewhere during the field render process, rather than all in one go. So the total number of queries is close to (number of results) x (number of fields) instead of just (number of fields) like it would be without the relationship.
(Yes, I have quite a few fields)
Is there any way I can get Views to load all of the referenced entities in one go, rather than in this inefficient one-by-one manner?