Closed chkeita closed 5 years ago
Hello @chkeita ,
By default, query plan is already shared across DbContext instance.
It uses the QueryCacheManager that is shared in the workspace to all your DbContext instance.
Is it possible for you to provide a runnable project that show this error (you can send it in private here: info@zzzprojects.com)
It will help us to understand your current issue. It might be caused because the plan is slighty different or another reason that we are not aware yet.
Best Regards,
Jonathan
Hello @chkeita ,
Can we close this issue? I believe we got no reply from your side.
I missed the notification for the first answer. Unfortunately, I am not allowed to share our code. But I will try to create a repro. I am not exactly sure how this is going to take so we can close this for now. And I will reopen it once I have the repro.
While profiling our asp.net application we discovered that a new execution plan seems to created every time the request is executed. The test sends 20 requests to the server which triggers the same request to the database. Each database request is executed on new DbContext instance.
Is there an option to cache the execution plan across instances of Db ?
This screenshot shows the cumulative time spent by multiple requests creating the execution plan.