Left join always loads *all possible columns* (instead of those selected) (!)
Suppose we have query like this:
_db.Users.Where(u => u.Active).Select(u => new {
UserName = u.Name,
OrgName = u.Organization.Name,
TeamName = u.Team.Name
});
Here Organization & Team are navigation properties. If corresponding OrganizationId and TeamId are non-nullable fields, i.e. EF uses inner join to load them, the query executes as expected, just loading only those three listed columns from the respective tables.
Now if TeamId is nullable, that is EF uses left join for u.Team.Name, the query is constructed to select all columns from User table and all columns from Team table (and apparently picks needed columns only in memory). I'm checking this behavior (generated queries) via Visual Studio's debug output. Obviously this is a massive performance hit (if there are many columns in those tables) in a relatively trivial scenario.
I'm seeing this in more than one project, and I'm sure I'm not missing anything, so this is a severe issue. I'm using 1.1.x version of EF core, can't update to v2 atm so not sure if problem is there also.
If this is a known issue, please point me to the right page that tracks it. If it is a new bug, I can provide more info & access to my workstation so that you can investigate more. Though this is such a severe issue that I'd be really surprised if nobody reported it yet.
Further technical details
EF Core version: 1.1 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 IDE: Visual Studio 2017 ASP.Net Core v1.1 projects
Duplicate of #6647. Fixed in 2.0 release