Today I made an interesting discovery and I would request a verification whether or not this can be true:
It seems that this:
var items = _contentManager.Query().Where<CommonPartRecord>(r => ids.Contains(r.Id)).List(); // Ids is a list of content item ids
foreach (var item in items )
... = item.Value.As<RoutePart>();
is slightly (~5%, but anyway) faster (!) than this:
var items = _contentManager.Query().Where<CommonPartRecord>(r => ids.Contains(r.Id)).Join<RoutePartRecord>().List();
// Later RoutePart fetching the same as previously
The Mvc MiniProfiler (thanks again Pete!) shows that indeed, the first query lacks the join on RoutePartRecords, while the sql query run upon the second content query correctly joins the table. So the latter should be faster, since the records used were
eager-loaded, not lazily one-by one. But it's not, and it frustrates me that I don't understand why.
I'm using a recent 1.x changeset,
Could somebody please enlighten me what kind of sorcery this is?