Joseph Sack over at SQL Server Centralhas written a short article on query optimisation using Query Analyzer’s graphical Show Plan.

Certainly an under used resource, show plan can actually give you insight to how SQL Server intends to / did run your query, and where high i/o or cpu taxing tasks are undertaken.

Joseph’s article runs over some of the best things to watch out for in a query plan. Any of these items can severly affect the speed of a query, but as Joseph points out, some of these items are necessary and ok in certain queries.

The two most common things I see when someone comes to me with a problem is unnecessary ordering results (Red Flag #7), or returning more rows than necessary (Red Flag #4). Table Scans (#2)due to incorrectly defined indexs and Hash Joins (#5) would come after that.

While I’d agree that no two DBA’s / Developers are going to agree on the best ways to improve a query, I’m sure everyone would agree that Show Plan is something every developer/dba should be using.