A coworker and I are looking at cleaning up the indexes on a few of our production databases. An obvious 1st place to start is to find and remove duplicate indexes. So, no issues there.What I want is to get, is the community’s thoughts regarding “redundant” indexes…For example: Index 1: (Col_1, Col_2) INCLUDE (Col_3, Col_4, Col_5) Index 2: (Col_1) INCLUDE (Col_2, Col_5)Clearly, Index 2 is redundant as it’s fully covered by Index 1… But… Depending on the size of certain columns, there is the potential that Index 1 could be MUCH larger than index 2 (has far more pages).So, my questions are:1) Do I want to drop index 2, based solely on the fact that it’s redundant?2) Do I need to set thresholds in terms of size differences?a. If they are close in size, drop index 2…b. If Index 1 is N times larger than index 2, keep index 2 for performance reasons…c. If so, what’s the threshold?3) Do I need to do a deeper dive into the index usage?a. Say I’ve got a proc that executes 20K times a day and it uses index 2 due to its smaller size, do I want to risk impacting the performance of that proc by forcing it to use the larger index 1?4) What other considerations need to be taken into account?5) Aside from using the before & after picture of sys.dm_exec_procedure_stats, what else do I need to do to check for degraded proc performance once an index has been dropped? Example 2: Index 1: (Col_1, Col_2) INCLUDE (Col_3, Col_4, Col_5) Index 2: (Col_1, Col_2) INCLUDE (Col_4, Col_6)In this scenario, either index can be made redundant, simply by adding Col_6 to index 1 OR adding Col_3 & Col_5 to index 2 (for the sake of clarity, let’s call these “delta columns”)…Questions:1) Do I want to do this?a. If the delta columns are small and won’t substantially impact the size of the updated index? (I’m thinking YES)b. If the delta columns are large and would have a significant impact on the size of the updated index? (I’m thinking probably not)c. Assuming that A & B are valid assumptions, what’s a reasonable “cut-off” point?Your input would be appreciated as would any links or articles on the topic. Google pulls up plenty of info regarding duplicate indexes but surprisingly little regarding redundant indexes.Thank you in advance,Jason
↧