MySQL Forums
Forum List  »  Optimizer & Parser

Re: Problems with query not using expeced indexes
Posted by: Rick James
Date: March 18, 2010 07:41AM

A column can be in multiple indexes.

About the only constraint is that there can be only one PRIMARY KEY.

Here is a wasteful (but not invalid) situation:
INDEX(a),
INDEX(a)
one is redundant.

UNIQUE(a),
INDEX(a)
remove the INDEX; UNIQUE is an index with an extra constraint (no dups of `a`).

INDEX(a,b)
INDEX(a)
Usually the second one is unnecessary; the first one can be used whenever the second one is desired.

INDEX(a,b)
INDEX(b,a)
These are significantly different; sometimes it is advisable to have both.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Problems with query not using expeced indexes
1914
March 18, 2010 07:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.