Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Index Duplication?

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-09-06 : 19:19:23
I have three indexes...

_dta_index_Activity_9_29243159__K9_K2_K8
_dta_index_Activity_9_29243159__K2_K9_K8
_dta_index_Activity_9_29243159__K2_K8_K9

They all reference the same columns but in a different order. I read that this isn't necessarily duplication since the order of the columns in the index can influence their use and effectiveness. In your opinion does the possible benefit out-weight the insert/update and database size cost?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-06 : 19:44:36
If those indexes are being used, then you should keep them. Have you run the DMV reports to see if they are being used?

And yes if the order of the columns is different, then these are not duplicates.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-06 : 19:45:33
Oh and this isn't an opinion thing. You base your decision on actual findings, not on opinions. You will be able to tell if you need these or not. You weigh that information against DML/disk costs.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-09-06 : 20:47:09
quote:
Originally posted by tkizer

If those indexes are being used, then you should keep them. Have you run the DMV reports to see if they are being used?

And yes if the order of the columns is different, then these are not duplicates.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



They are being used. I guess the question is - will they use the other very similar index if I delete the one currently being used without much performance difference? The problem (and maybe it isn't a problem really) is that I currently have 13 indexes on my largest table (20 million records). That table with the indexes uses about 15 gigs of space. It is a heavily read and write table so there is a cost to having so many indexes. Just trying to find a balance...
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-06 : 22:49:13
It really depends on your queries. Run the DMV "indexes in use" report and verify the reads and writes on each of them. You'll have a good indication from there what to do.

13 indexes isn't all that much and neither is 15GB. The write cost should really be very small if you've got sufficient I/O.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-09-07 : 02:50:56
13 indexes is tame for DTA. I'm dealing with one that has 85 (down from 92)

As for index columns and order, see http://sqlinthewild.co.za/index.php/2009/01/19/index-columns-selectivity-and-equality-predicates/

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -