EF Core 2.0 的 GroupBy 就是这样的,使用 EF Core 2.1 才能解决这个问题,但 EF Core 2.1 目前处于 Preview 1 ,详见 Announcing Entity Framework Core 2.1 Preview 1:Before version 2.1, in EF Core the GroupBy LINQ operator was always be evaluated in memory. We now support translating it to the SQL GROUP BY clause in most common cases.