 |
|
SQL Server Tips by Burleson |
Rewrite and Benchmark
When the SQL is valid, the objects are in order, and object-based
resolutions have been investigated, it is time to begin trying
different code combinations in hopes of improving the query’s
performance. This is where SQL tuning becomes an art.
Using hints, changing subqueries to joins, switching UNION’s to
UNION ALL’s can become time consuming but rewarding as tuning
becomes easier.
Once the DBA has assembled a suite of new SQL combinations for the
existing query, it is time to actually send them through the
database to see if anything is being accomplished. When performing
these informal benchmarks, it is important to do them correctly.
For example, each query should not just be executed one time and the
measurements recorded. First time executions typically take longer
than subsequent tries due to parse activity and data being read in
the first time from disk. At a minimum, each new query should be
sent through three to four times with the high and low readings
thrown out.
The above book excerpt is from:
High-Performance SQL Server DBA
Tuning & Optimization Secrets
ISBN:
0-9761573-6-5
Robin Schumacher
http://www.rampant-books.com/book_2005_2_sql_server_dba.htm |