Query Processing Best Practices
In this final section, we’ll present some general recommendations for getting the best performance from your queries. You’ve probably seen most of these recommendations before, but they are so important, that it can’t hurt to be reminded.
Use Set-Oriented Programming
This first suggestion has been mentioned earlier in this chapter, but it is probably the number-one query performance issue with new SQL Server developers. Any code written to examine and manipulate a set of rows should be implemented using Transact-SQL’s own set-based operations. Defining a cursor to step through the rows in a table is a giant step backwards, and causes you to lose most of the power of the SQL Server data processing engine.
Defining ...
Get Inside Microsoft® SQL Server™ 2005: Query Tuning and Optimization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.