SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

ferrethouse
Constraint Violating Yak Guru

343 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?

visakh16
Very Important crosS Applying yaK Herder

India
52325 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
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000