Thursday, April 08, 2010

SQL query optimization tip

If you change your query in management studio query window like this:


SET STATISTICS TIME ON

Go

SET STATISTICS IO ON

Go

[Your query]


you can check Messages. There are lot of useful information there (timers, seeks for each table). Using this and using execution plan you can better optimize your sql queries.