Is the primary key automatically indexed in MySQL?

Alex Miller picture Alex Miller · Jul 1, 2009 · Viewed 87.3k times · Source

Do you need to explicitly create an index, or is it implicit when defining the primary key? Is the answer the same for MyISAM and InnoDB?

Answer

Emil H picture Emil H · Jul 1, 2009

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.