List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 20 2002 10:06pm
Subject:Re: Indexes That Span Columns...
View as plain text  
At 14:12 -0500 12/20/02, Andrew Kuebler wrote:
>I have the following table; I renamed the columns a & b for easy
>reading:
>
>ID INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
>aID INT(9),
>bID MEDIUMINT(7),
>UNIQUE ab (aID, bID)
>INDEX b(bID)
>
>As far as I understand the UNIQUE INDEX also provides the index for aID,

Right, although it won't necessarily be a unique index.

>but not bID. Is there any other way to have a UNIQUE INDEX across aID &
>bID that will also provide an INDEX individually for the 2, or do I
>still have to build a second INDEX separately just for bID?

The latter; you need a separate index on bID.

>
>I'm using MySQL 4.0.1, maybe a new version has a better way to do this?
>
>Thank you in advance...
>
>Andrew

Thread
Indexes That Span Columns...Andrew Kuebler20 Dec
  • Re: Indexes That Span Columns...Paul DuBois20 Dec