How to test performance for your database Best practice
I need to test in开发者_JS百科dexes 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?
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.
精彩评论