suresh_kamrushi Posted May 26, 2011 Share Posted May 26, 2011 What is the difference in Primary key and unique key? Link to comment https://forums.phpfreaks.com/topic/237487-primary-key-and-unique-key-difference/ Share on other sites More sharing options...
gizmola Posted May 26, 2011 Share Posted May 26, 2011 The difference depends on the engine. A primary key in innodb actually dictates the physical ordering of the data on disk. The innodb data file is basically a giant index itself that is already ordered in PK order and it contains all the data, so whenever you need to get some rows out, if the primary key was used innodb already has the data available, rather than having to first read the index file and then read the actual data. A myisam PK is exactly the same as a table with a unique index on the same column(s). Link to comment https://forums.phpfreaks.com/topic/237487-primary-key-and-unique-key-difference/#findComment-1220400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.