There is already a primary key index on ID. 

-----Original Message-----
From: Wm Mussatto [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 01, 2008 10:50 AM
To: mysql@lists.mysql.com
Subject: Re: Indices in InnoDB/MySQL

On Tue, April 1, 2008 10:01, Robert DiFalco wrote:
> I've been told that an index always contains the primary key. So if I 
> have a LONG ID that is the primary key of table and create on index on

> LONG VALUE, the index on LONG VALUE will actually work as a typical 
> compound index on ID,VALUE. My question is this, if I don't know that 
> about MySQL and create my indices on purpose (i.e. not taking into 
> account implementation details about MySQL) I would create the index 
> explicitly on ID,VALUE. If I did that would I effectively have the 
> same index as one on just VALUE or would there some how be duplicate 
> data in the ID,VALUE index (i.e. ID, ID, VALUE)?
>
> R.
>
Close but not quite there...
You should always have AN index which is the primary key.  You can
create other indexes which don't.  If you are searching for 'Value' then
that should be the index.  If you do ID,VALUE it can't use the index
AFAIK because it won't know the ID.
------
William R. Mussatto
Systems Engineer
http://www.csz.com
909-920-9154





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to