Query Improvements

Many techniques are available for improving the performance of your queries. Some of the techniques are no more complicated than simply rewriting some of your Transact-SQL code, while others involve some redefinitions of your database schema, verifying that appropriate statistics are available, or the creation of new indexes. In other cases, you may find that you need to supply specific information to the query optimizer in the form of hints to get the maximum possible performance from your queries. The following sections describe these possible areas of improvement.

Rewriting Your Query

Frequently, you can write the same query in many ways. As we’ve seen, these rewrites often result in different—sometimes better and sometimes ...

Get Inside Microsoft® SQL Server™ 2005: Query Tuning and Optimization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.