How to optimise T-SQL query using Execution Plan

Neo 2013-08-09 10:19:52

I have a SQL query that I have spent the past week trying to optimise using trial-and-error and the execution plan, but to no avail.

I have done a fair amount of T-SQL, but using execution plans to optimise my query is a new area for me and I have really tried to understand how to do it. So, if anyone could help me with this and explain how this execution plan can be deciphered to find ways in the query to optimise it, I would be eternally grateful. I have many more queries to optimise – I just need a springboard to help me with this first one.

JasonRHall 2013-08-09 12:43:22
Hi and welcome to SQLPerformance.com!

I believe that there are plenty of possibilities here. I'm sure others will point out a lot of them, but the very first thing I notice upon opening this is how far off the estimates are from the actuals.

I'm not going to try and explain a lot myself, because there is actually a great article on the site by Joe Sack (b|t) that does a better job than I could here.

If this were my query, I would start there.

I hope this helps!

wherrera 2013-08-09 13:45:29
The first step you want to try is to avoid the table scan. Creating a covering index will probably help.