Prevent auto increment on MySQL duplicate insert
Using MySQL 5.1.49, I'm trying to implement a tagging system the problem I have is with a table with two columns: id(autoincrement) , tag(unique varchar) (InnoDB) When using query, INSERT IGNORE INTO tablename SET tag="whatever" , the auto increment id value increases even if the insert was ignored. Normally this wouldn't be a problem, but I expect a lot of possible attempts to insert duplicates for this particular table which means that my next value for id field of a new row will be jumping way too much. For example I'll end up with a table with say 3 rows but bad id 's 1 | test 8 | testtext