I noticed a weird Sql translation in the LinqToSql query that I was trying to optimize.
If I performed the following
Recipients.GroupJoin(
RecipientAttributes,
x => x.Recipient_Id,
y => y.Recipient_Id,
(x,y) => new {Recipient = x, Attributes = y})
.Skip(1)
.Take(1000)
It executes in a single request, as expected.
However
Recipients.GroupJoin(
RecipientAttributes,
x => x.Recipient_Id,
y => y.Recipient_Id,
(x,y) => new {Recipient = x, Attributes = y})
.Skip(0)
.Take(1000)
runs in a separate request for each attribute selection.
Removing gaps (0) also does not matter.
Can someone explain this and is there something I can do to get the first page request running in a single sql statement?
Ollya source
share