-
Notifications
You must be signed in to change notification settings - Fork 934
Cache query plan for DML LINQ queries #2229
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
Cache query plan for DML LINQ queries #2229
Conversation
Not sure if it is a good idea to cache a DML query. |
Or is it about a query plan cache? |
Yes. It's exactly about query plan cache. |
This comment has been minimized.
This comment has been minimized.
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.
Regarding changes in #1544. I think of another fix for cached constants - we should "parametrize" them.
This is not straightforward to do, as far as I remember when I have looked into this for #1544. Parameterized constant works as parameters in the generated SQL queries, but these projections are run in-memory, and are not translated to SQL.
This reverts commit 8c7444d
Fixes #2222
Maybe I'm wrong but it seems cached constants are not possible with DML queries (as no result transformers are supported). So let's just ignore
CanCachePlan
check for DML queries.Regarding changes in #1544. I think of another fix for cached constants - we should "parametrize" them. So that such queries should be cachable. I mean for query like:
Currently transformer is generated with embedded constants inside. Which for query above should generate something like:
Instead we should generate something like this:
And provide
NhLinqExpression.ParameterValuesByName
forparameters
parameter.