You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entity-framework/core/what-is-new/ef-core-10.0/whatsnew.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,53 @@ Unfortunately, C# query syntax (`from x select x.Id`) doesn't yet support expres
334
334
335
335
See [#12793](https://github.com/dotnet/efcore/issues/12793) and [#35367](https://github.com/dotnet/efcore/issues/35367) for more details.
336
336
337
+
### More consistent ordering for split queries
338
+
339
+
Split queries can be essential to avoid performance issues associated with JOINs, such as the so-called "cartesian explosion" effect (see [Single vs. Split Queries](xref:core/querying/single-split-queries) to learn more). However, since split queries loads related data in separate SQL queries, consistency issues can arise, possibly leading to non-deterministic, hard-to-detect data corruption.
340
+
341
+
For example, consider the following query:
342
+
343
+
```C#
344
+
varblogs=awaitcontext.Blogs
345
+
.AsSplitQuery()
346
+
.Include(b=>b.Posts)
347
+
.OrderBy(b=>b.Name)
348
+
.Take(2)
349
+
.ToListAsync();
350
+
```
351
+
352
+
Prior to EF10, the following two SQL queries were generated:
INNER JOIN [Post] AS [p] ON [b0].[Id] = [p].[BlogId]
366
+
ORDER BY [b0].[Name], [b0].[Id]
367
+
```
368
+
369
+
Note that the first query (the one reading Blogs) is integrated as a subquery within the second (the one reading Posts). However, the ordering within the subquery omits the `Id` column, leading to possible incorrect data being returned.
370
+
371
+
EF10 fixes this by ensuring that the ordering is consistent across the queries:
0 commit comments