-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add infrastructure for too many Includes warning. #20140
Conversation
@smitpatel My part of #19933. Warning is not wired up yet--need you for that. |
What is our cut-off to generate warning? |
@smitpatel I'll just let you take over this PR in whatever way you want, since I can't get approval to merge until the complete change is done anyway. |
@smitpatel If the query has two or more collection includes or collection nav expansions then we should generate the warning |
/// <param name="diagnostics"> The diagnostics logger to use. </param> | ||
/// <param name="expressionPrinter"> Used to create a human-readable representation of the expression tree. </param> | ||
/// <param name="queryExpression"> The query expression tree. </param> | ||
public static void TooManyIncludesWarning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The place we know that there too many includes in relational, we don't have actual expression tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smitpatel I can update it to take whatever you have available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss in triage today.
I looked at this further, the place where we accurately know that there is multiple collection projection, we only have SelectExpression. Further, in order to print SelectExpression in most readable format, we need sql generator which we don't have. Any other place to identify this requires a public surface on places where we don't want to add public surface. (even if we add in patch, it would be throw away work). At this point, warning seems pretty low value as if query (with or without multiple collection include), either it works just fine or perf is pretty bad and customers would know. |
@smitpatel Can we get any type of string from the SelectExpression? If so, can you post examples of what it looks like? |
Can strip out shaper if needed
|
@smitpatel Thanks. Let's discuss again in triage. :-) |
This still has value. If one needs to identify the query that triggers the warning they can just set it to throw. |
You mean warning or exception message? Because in today's triage while discussing, people said, if we cannot give good indication of which query then it is not useful. |
It's one and the same, depends on user configuration.
If it throws then it's clear |
@@ -250,6 +250,10 @@ | |||
<value>Possible unintended use of a potentially throwing aggregate method (Min, Max, Average) in a subquery. Client evaluation will be used and operator will throw if no data exists. Changing the subquery result type to a nullable type will allow full translation.</value> | |||
<comment>Warning RelationalEventId.QueryPossibleExceptionWithAggregateOperatorWarning</comment> | |||
</data> | |||
<data name="LogTooManyIncludesWarning" xml:space="preserve"> | |||
<value>The query '{query}' uses 'Include' for more than one collection navigation property. Including multiple collections can result in slow query performance. See ... for more information.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to replace the ...
And add "To identify the query that's triggering this warning call .ConfigureWarnings(w => w.Throw(RelationalEventId.LogTooManyIncludesWarning))
"
@smitpatel What I intended to say in triage was, "if we cannot give any indication of which query then it is not useful." |
Blocked for now until we have the new code in place. |
@smitpatel Is this PR now obsolete? |
How else will the users find out that they need to call the new API? |
@AndriySvyryd I meant specifically this PR, not the concept of having a warning. |
So should I put this thing to master and generate warning when not split query and more than one collection is being projected/included? |
@smitpatel Yes. :-D |
Superseded by #21419 |
Part of #19933