Comments - INSERT ON DUPLICATE KEY UPDATE
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
It was already mentioned above. Just to emphasize it: You can easily exhaust AUTO_INCREMENT values with ON DUPLICATE KEY UPDATE if you have a PK and a UK:
create table t1 (id int unsigned not null auto_increment primary key, a int, b int, c varchar(64), unique key (a, b)); insert into t1 (a, b, c) values (1, 2, 'bla') on duplicate key update id=id; -- INSERT insert into t1 (a, b, c) values (1, 2, 'bla') on duplicate key update id=id; -- NOOP but AUTO_INC++ insert into t1 (a, b, c) values (1, 2, 'bla') on duplicate key update id=id; -- NOOP but AUTO_INC++ insert into t1 (a, b, c) values (1, 3, 'bla') on duplicate key update id=id; -- INSERT
select * from t1; +----+------+------+------+
+----+------+------+------+
+----+------+------+------+
SHOW CREATE TABLE t1 ... ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1