Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Conditional mysql insert question - how to prevent duplicates


brotherhood_of_LAN - 10:20 pm on Aug 3, 2011 (gmt 0)


Hard to say. Removing it puts you at risk of having duplicate values for the current PK as auto_increments have to be an index of some sort (in this case, a standard INDEX that accepts duplicates).

If you don't foresee that as a problem and you don't regularly query the current PK row then feel free to give it a try. If you don't reference the current PK field in INSERT's to the table then the duplicate problem should never arise.

If the table's primary role is to store unique $term/$url combinations and the current PK is merely a more compact reference to it, I'd say change to the new PK.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4347419.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com