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

Consider removing identifier orderings when doing identity resolution #24377

Open
roji opened this issue Mar 11, 2021 · 0 comments
Open

Consider removing identifier orderings when doing identity resolution #24377

roji opened this issue Mar 11, 2021 · 0 comments

Comments

@roji
Copy link
Member

roji commented Mar 11, 2021

When loading related entities, we currently generate orderings to group together rows for the same entity. This is necessary for queries without identity resolution, since the shaper detects that new entities by the change in identifier. However, queries with identity resolution perform local lookup anyway, so these orderings aren't needed.

For example, consider a Blog with two collection navigations, Posts and Authors. When loading this entire graph, we currently generate:

SELECT [b].[Id], [b].[Name], [p].[Id], [p].[BlogId], [a].[Id], [a].[BlogId]
FROM [Blogs] AS [b]
LEFT JOIN [Post] AS [p] ON [b].[Id] = [p].[BlogId]
LEFT JOIN [Author] AS [a] ON [b].[Id] = [a].[BlogId]
ORDER BY [b].[Id], [p].[Id], [a].[Id]

Queries using identity resolution could omit the last two orderings.

This would potentially imply more local dictionary lookups, as rows are returned unordered and the shaper needs to jump back and forth between instances. My gut feeling is that the server-side ordering is much more expensive, but we'd have to confirm this first.

/cc @smitpatel

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