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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 Possible duplicate indexes
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

352 Posts

Posted - 06/17/2013 :  17:23:26  Show Profile  Reply with Quote
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?

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 06/18/2013 :  00:52:43  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000