MySQL Forums :: Performance :: Multi-Column indexes

Advanced Search

Multi-Column indexes
Posted by: Michael Preiss ()
Date: October 08, 2011 06:45PM

Hello forum,

this has been bothering me for a while and I just cant seem to get a definitive answer.

Let's assume I have a table like this:

Now this obviously works great if columns A,B,C,D or A,B,C or A,B OR A are used in the where clause.

But what happens if I have to omit say column C because what I want to achieve would be "give me the rows where A=x, B=y, and D=z, regardless of the value of C".

Do I need a second index like INDEX(Col_A,Col_B,Col_D) or is mysql smart enough to figure it out?

Thanks in advance for your help.

fixed thread title. oops.

Edited 1 time(s). Last edit at 10/09/2011 10:55AM by Michael Preiss.

Options: ReplyQuote

Subject Views Written By Posted
Multi-Column indexes 2528 Michael Preiss 10/08/2011 06:45PM
Re: Multi-Cell indexes 719 Jørgen Løland 10/09/2011 10:56AM
Re: Multi-Cell indexes 857 Michael Preiss 10/09/2011 11:55AM
Re: Multi-Cell indexes 684 Jørgen Løland 10/09/2011 12:10PM
Re: Multi-Cell indexes 692 Michael Preiss 10/09/2011 02:40PM
Re: Multi-Cell indexes 691 Rick James 10/11/2011 09:25PM
Re: Multi-Cell indexes 740 Jørgen Løland 10/12/2011 12:04AM
Re: Multi-Cell indexes 624 Michael Preiss 10/14/2011 10:02PM

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.