views:

514

answers:

4

Do you need to explicitly create this or is it implicit when define the primary key? Is the answer the same for MyISAM and InnoDB?

+6  A: 

No, the primary key is always indexed. This is the same for MyISAM and InnoDB, and is generally true for all storage engines that at all supports indices.

Emil H
Ugh beat by about 30 seconds...and I includced a reference URL...you win this quick draw contest
PSU_Kardi
+2  A: 

No you do not to explicitly create an index for a primary key... it is done by default.

Rick
+1  A: 

The primary key is implicitly indexed for both MyISAM and InnoDB. You can verify this by using EXPLAIN on a query that makes use of the primary key.

Patrick Gryciuk
+1  A: 

According to http://dev.mysql.com/doc/refman/5.0/en/constraint-primary-key.html it would appear that this is would be implicit

PSU_Kardi
I found that page before I asked the question but it doesn't appear to have anything to do with the question.
Alex Miller
I found that link by searching before I asked the question. But it doesn't seem to imply that or anything else much about this question to me.
Alex Miller