Why does the Clustered Index Seek take 45% of plan?
Thanks
Sorry it's taken so long to get an answer back to you…
The Clustered Index Seek is searching for rows according to Column4, which must be the Clustered Index value. This is actually pretty efficient. You could make a nonclustered index to achieve the same, by indexing Column4 (making it a unique index) and making sure that Column93 and Column94 were both 'included columns', but there's very little to gain from this.
The reason why it's estimated (remember that the costs in a sqlplan are only estimates based on IO) to take 45% of the plan is because it's having to do that Seek over half a million times! It's probably an estimated 45% of the logical IO, but probably not anywhere close to 45% of the CPU or Time effort in this query.
Doing half a million seeks on a table is not necessarily that bad. It's really not. I've seen plenty of examples where despite the Estimated Cost of that operator being high, it's actually a remarkably efficient query. I once tuned a query that took over a minute with 300,000 reads down to a query that took just a few seconds with nearly 10,000,000 reads – because the data in the table with the Seeks was quickly loaded into RAM and then the same data was read over and over again.
For tuning this query, I would actually be more concerned about the two Hash Matches on Object14 and Object10, which are large – 604MB and 796MB respectively.
Rob