tisdag 16 oktober 2007

SQLQueryStress

I want to recommend a good tool when you are optimizing your queries.

Often after a trace you will find that only a couple of your queries ends up taking the majority of the cpu.

Sometimes it's as easy to solve the problems by just adding an index, and sometimes there will be other solutions.

Whatever solution you choose, it can be a good thing to test your query.

The SQLQueryStress tool written by Adam Machanic, can be downloaded here http://www.datamanipulation.net/SQLQueryStress/.

SQLQueryStress is very simple although very powerful. You can use parameter substitution so you can execute your queries with different parameters. You can set the number of iterations but also the number of threads (clients).

The output from this is "cpu seconds", "elapsed time", "client seconds", "logical reads", and more.

So when you compare two queries and booth queries takes the same time to execute, you can easily see in this program if one of them use less cpu or maybe less IO over several executions and with different parameters.

Inga kommentarer: