Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop projecting last identifier when not needed #32329

Open
roji opened this issue Nov 17, 2023 · 0 comments
Open

Stop projecting last identifier when not needed #32329

roji opened this issue Nov 17, 2023 · 0 comments

Comments

@roji
Copy link
Member

roji commented Nov 17, 2023

LINQ:

_ = context.Blogs.Select(b => b.Numbers.ToList()).ToList();

SQL Server SQL:

SELECT [b].[Id], CAST([n].[value] AS int) AS [value], [n].[key]
FROM [Blogs] AS [b]
OUTER APPLY OPENJSON([b].[Numbers]) AS [n]
ORDER BY [b].[Id], CAST([n].[key] AS int)

We need to order by the key here in order to preserve the collection's ordering; however, there's no reason to project it out to the client. Note the similarity with #19828 - there we removed the last identifier column from the ordering, but not from the projection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants