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 2012 Forums
 SQL Server Administration (2012)
 Possible duplicate indexes

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2013-06-17 : 17:23:26
I have a table called "Activity". It is a large table with about 45 million rows. There are currently about 10 indexes on the table. It is heavily written to and read from so the indexes are needed but they do have a cost.

I ran a query that identified some indexes that could possibly be merged. All of the indexes on the table are currently heavily used but it is hard to tell if the cost justifies the benefit.

So my question is this... these are the key columns of the non-clustered indexes it suggests could be redundant...

StudentsID, LessonID, ActivityFinished
StudentsID, LessonID, ActivityID, ActivityFinished
StudentsID, LessonID, ActivityID, ActivityStarted
StudentsID, LessonID, AttemptID, ActivityID

"StudentsID" and "LessonID" together should be highly selective - resulting in in fewer than 100 rows in most cases. So if I create an index with those two columns as keys and "include" the other columns I should be able to get rid of these 4 indexes right?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-18 : 00:52:43
ideally yes.
What you could do is to create a copy of main table in dev box and then try out both alternatives. In that way you would be able to see how one benefits over the other and may decide to use the best approach.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -