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
2009-07-01 20:24:32
Ugh beat by about 30 seconds...and I includced a reference URL...you win this quick draw contest
PSU_Kardi
2009-07-01 20:29:47
+2
A:
No you do not to explicitly create an index for a primary key... it is done by default.
Rick
2009-07-01 20:24:49
+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
2009-07-01 20:25:05
+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
2009-07-01 20:25:27
I found that page before I asked the question but it doesn't appear to have anything to do with the question.
Alex Miller
2009-07-01 20:44:15
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
2009-07-01 20:45:58