efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Remove DISTINCT inside singleton queries

Open ranma42 opened this issue 1 year ago • 1 comments

When a (sub)query results in 0 or 1 elements (First(), Last(), FirstOrDefault(), LastOrDefault(), Take(0/1), ...), DISTINCT has no effect and can be removed.

Conceptually this is a continuation of #31016

ranma42 avatar Aug 20 '24 20:08 ranma42

Makes sense, thanks @ranma42.

roji avatar Aug 20 '24 23:08 roji