Get rid of Key Lookups
Sunday, August 29, 2010 at 10:23PM If you see "Key Lookup" in your execution plan you can build a covering index to speed things up. Doing a Key Lookup is less optimal than an Index Seek, so when you see these in your execution plans know that you have the option of making this particular operation faster. Albeit with the chance of adding overhead to the maintenance of your existing index.
Generate your execution plan and hone in on the Key Lookup operations like the one below:
Look at your Nested Loops operation and identifity the columns it's looking for. An easy way to do this is to right-click on the operation when viewing your execution plan then navigating to Properties - or mashing F4 when it's selected.
Now go to Object Explorer and script out the existing index. Under Included columns add all columns that are contained in the Nested Loop operation that aren't already in the existing index.
An included column is adding a non-key column to the leaf level of the index. There will be a slight overhead to your index upkeep, but if this is an often-executed operation it might be well worth it!

Reader Comments