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
4674
April 27, 2010 05:30AM
Re: Composite Primary Key
1922
April 29, 2010 11:19PM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.