Ask the Expert

Redundant composite indexes

I have a question regarding composite indexes. I have just taken over a database and I notice that there are redundant composite indexes for various tables. By redundant I mean, for example, that TABLE T1 has INDEX_1 on columns (col1, col2, col3), and there is a second index INDEX_2 on columns (col1, col2, col3, col4). I would like to know why two indexes of this kind are required? In such a case isn't it possible to get rid of INDEX_1, since the columns indexed in INDEX_1 are part of INDEX_2 as well and are in fact in the same order, so automatically INDEX_2 can be used for all queries on col1, col2, col3 and col4. Please let me know if I am missing anything.

    Requires Free Membership to View

You are correct. INDEX_1 is redundant and should be dropped.

This was first published in January 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: