For this table, in mysql 5.7,
CREATE TABLE `t` (
`id` int(10) unsigned NOT NULL,
`val` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
- The table doesn't have autoincrement column
- The table doesn't have partitions
- There ONLY queries that are performed on this table are INSERT and SELECT
- the table is not used in any subqueries
- sql_mode doesnt have any STRICT_* enabled
I need to insert into this table, but the id
value exists in >50% of the cases.
I want to use a single INSERT IGNORE instead of "SELECT id" , if doesnt exist "INSERT"
When doing an INSERT IGNORE, (NOT a multi-insert one), and the PRIMARY KEY exists, is/can there ANY locking involved ?