MySQL Forums
Forum List  »  Optimizer & Parser

Re: Composite Primary Key
Posted by: Rick James
Date: April 29, 2010 11:19PM

A PRIMARY KEY is UNIQUE.
If "id" is UNIQUE, then (id, ...) is not a reasonable PRIMARY KEY.
An example of a reasonable compound primary key: (country, city) for a table that has one row per major city in the world.
InnoDB needs a PRIMARY KEY in order to correctly deal with "transactions". (MyISAM does not care.)

Do those answer your question? If not, plz present more about your application, especially some of the INSERTs/SELECTs/UPDATEs.

Options: ReplyQuote


Subject
Views
Written By
Posted
4583
April 27, 2010 05:30AM
Re: Composite Primary Key
1879
April 29, 2010 11:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.