I have multiple concurrent processes inserting records in a table having a unique primary key. The isolation level is READ COMMITED (with InnoDB). Two processes could do an INSERT of the same primary key exactly at the same time.

Question 1)

Does MYSQL Server accept one INSERT and raise DUPLICATE KEY error for the other one ? Or, are the two records rejected ?

Question 2)

Is the duplicate key error checked at the end of the INSERT statement or at the end of the transaction (COMMIT) ?

Question 3)

A last and dummy one ! Sorry about that.

Does the database server always PHYSICALLY execute 1 (and only 1) modify statement (UPDPATE,INSERT,DELETE) at once, even at user level programmer is thinking in terms of concurrent statements ?

Thanks for any help.