views:

58

answers:

4

Here is the scenario:

I have run a trace for few hours during maximum server load using the three events (never mind this) that DTA looks for. I then stop and feed this profiler load to DTA. It does its tuning work and gives me feedback on what indexes need to be put.

Here is the question:

Several (upto 15) different indexes recommendations are for single table. If I let DTA do its work does this mean several indexes are going to be created for this? Is this not going to be a problem?

A: 

Without knowing any more about the tables, queries or indexes, the answer has to be "it depends"...

You need to take the output from the DTA as a starting point. If you look at the recommended indexes, you may find that there is some overlap between them in order to reduce the number of indexes.

AndrewWithey
So this means I need to look into it one by one?
Tesnep
+1  A: 

DTA does a reasonable in many circumstances, but it doesn't always make the optimum recommendations. Overlaps are quite common, as is the duplication of the clustered index as a non-clustered index(!).

If you want to do this more accurately by hand: MS SQL Server 2008 - How Can I Log and Find the Most Expensive Queries?

Mitch Wheat
How do I go about this situation then? And there isn't just this one table. There are several tables for which are several recommendations. I don't think I have the time to look into them one by one.
Tesnep
I was thinking of taking a route similar to this than trusting DTA to do this after seeing the results. Thanks for the Link.
Tesnep
A: 

Optimisation of SQL server is complex and depends heavily on the data in your database. The only real way to determine what affect changes will have is to perform performance and load testing against your database using representative data (preferably a backup of your live database)

That said, 15 indexes seems like a lot to me - a large number of indexes may have a detremental affect on the speed of writes against that table. DTA has probably taken each query run against that table individually and come up with the optimum indexes for each query. You will probably find that its possible to recuce the number of indexes by creating indexes suitable for multiple queries - this might mean that some queries are slightly slower that with all 15 indexes, however the chances are that you will be able to get 99% of the improvement.

Kragen
It is showing 96.5% improvement but I think I agree with you on some queries being slower because of the new indexes. These are mostly select statements. The server takes a lot of hits and the queries are similar (not same and cannot be cached). The representative data is quite representative. I will run this several times before I go with DTA though. I will also check for long running, frequently running, deadlocks and so on. I simply am in no hurry. But thanx for the info.
Tesnep
Another thing to note - if you apply the indexes (exactly as the DTA suggested) and then re-run the DTA you might still have additional indexes suggested by the DTA. My advice would be to consider each index individually until you come up with indexes that have a significant improement on performance (if an index simply takes 20 ms off a 2 second executiuon time, then is it really worth it?)
Kragen
A: 

15 indexes does seem like a lot for a single table. I would look at the actual queries themselves that are run against it.

Look for places where changes to the query structure will all them to work against either existing indexes or a small subset of the proposed indexes.

Chris Lively