Recently I was asked by my client of Comprehensive Database Performance Health Check, is there any way to know if the executed query is from cache or not. Well, of course, there is an easy way to know this and that is Execution plan property. Let us learn about it today.
First, run any query with an execution plan. There are multiple ways to enable execution plans. I have previously blogged about it here: SQL SERVER – 3 Different Ways to Explore Actual Execution Plans.
Now that you have enabled the execution plan, run the query. Once the query is run, right-click on the leftmost operator (if you have run the SELECT statement, it will be the SELECT operator) and go to properties. Now on the right side expand the section OptimizerStatsUsage. Under this section, you will see all the statistics used for that particular query.
I hope this helps you to further troubleshoot your queries which are giving you trouble with performance. Execution plan property is a very handy tool.
Here are my few recent videos and I would like to know what is your feedback about them. Do not forget to subscribe SQL in Sixty Seconds series. I hope you appreciate learning about the Last 5 SQL in Sixty Seconds Video.
- Detecting Memory Pressure – SQL in Sixty Seconds #186
- CPU Running 100% – SQL in Sixty Seconds #185
- Generate Script of SQL Server Objects – SQL in Sixty Seconds #184
- Prevent Unauthorized Index Modifications – SQL in Sixty Seconds #183
- MAX Columns Ever Existed in Table – SQL in Sixty Seconds #182
- Tuning Query Cost 100% – SQL in Sixty Seconds #181
- Queries Using Specific Index – SQL in Sixty Seconds #180
- Read Only Tables – Is it Possible? – SQL in Sixty Seconds #179
- One Scan for 3 Count Sum – SQL in Sixty Seconds #178
- SUM(1) vs COUNT(1) Performance Battle – SQL in Sixty Seconds #177
- COUNT(*) and COUNT(1): Performance Battle – SQL in Sixty Seconds #176
If you have any questions, you can always reach out to me on Twitter.
Reference:Â Pinal Dave (http://blog.SQLAuthority.com)
3 Comments. Leave new
I do not understand this, what has statistics usage to do with the caption of this article?
Thanks for a great catch. I fixed the image.
I got a execution plan and saved it and restarted sql server services which clears the cached plan when i tried to use it in the existing execution plan by using OPTION(USE PLAN) and i did not get the performance which i gained. Is it possible to add the execution plan in to sql cache which can be reused when we used the same query.