views:

42

answers:

1

Hi, I need to test indexes performances for some table in my database.

After I run my query with indexes or without them I always use this code;

SELECT * FROM sys.dm_exec_query_optimizer_info;

And I receive details about my query.

My problem is:

using sys.dm_exec_query_optimizer

The details for my query are always changing making difficult to understand. What is the best solution?

Do you know any way or best practices?

+1  A: 

You have to learn what the query optimizer is telling you. That the data changes is good; it means that things behave differently depending on whether you have indexes or not. However, there is no standardization on how optimizer information is presented - each DBMS does it differently. If you are going to interpret the data, you must understand it.

Looking at the query plan is important. Ultimately, so to is measuring the actual performance. It depends in part on why you are looking at the indexing at all. If there's a perceived performance problem that you are addressing, then clearly you need to ensure that the problem is resolved by the index or indexes you add. You also need to ensure that the cost of adding the indexes on maintenance operations (insert, delete, update operations) is not intolerable - you have not added too many indexes. You may also need to consider disk space usage - is it OK to commit so much disk space to so many indexes.

Without more specific information about your DBMS or the particular queries, it is hard to give more specific advice.

Jonathan Leffler
Thanks Jonathan to spent your time on my questions, I am new in SQL and any advice is really welcome. I am using MS SQL 2010.
GIbboK
@GibboK: Using MS SQL 2010 moves you outside my sphere of detailed knowledge, and detailed knowledge is going to be necessary (as intimated in my answer).
Jonathan Leffler
Especially because MS SQL 2010 DOES NOT EXIST. The last release is MSS SQL 2008 R2.
TomTom
@TomTom: OK - that just goes to show how far outside my realm of detailed knowledge it is necessary to go.
Jonathan Leffler
sorry guys! my mistake I have MS SQL 2008 :-)
GIbboK