forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The following expressions are equivalent (the arrow describes the preferred direction):
No-op:
- source.Skip(0) -> source
- source.Where(true) -> source
Absorb:
- source.Take(0).* -> source.Take(0)
- source.Take(0) -> whatever.Take(0)
- source.Where(false) <-> source.Take(0)
Commutativity:
- source.OrderBy(x).Where(y) <-> source.Where(y).OrderBy(x)
- source.Where(x).Distinct() <-> source.Distinct().Where(x)
Simplifications:
- source.Where(x).Where(y) -> source.Where(x && y)
- source.OrderBy(x).OrderBy(y) -> source.OrderBy(y)
- source.Take(x).Take(y) -> source.Take(Min(x, y)) Optimize multiple consecutive
LIMITs dotnet/efcore#35384 - source.Skip(x).Skip(y) -> source.Skip(Max(x, 0) + Max(y, 0))
- source.Take(x).Skip(y) -> source.Skip(y).Take(Max(x, 0) - Max(y, 0))
Operations on singletons:
- source.Distinct().Take(1) -> source.Take(1) Optimize DISTINCT over singleton collections dotnet/efcore#34702
- source.Take(1).Distinct() -> source.Take(1) Optimize DISTINCT over singleton collections dotnet/efcore#34702
- source.Take(1).OrderBy(x) -> source.Take(1) Remove ORDER BY applied to singleton queries dotnet/efcore#35214
Metadata
Metadata
Assignees
Labels
No labels