After playing yesterday a bit with INSERT ... SELECT I decided to check is Innodb locks are relly as efficient in terms of low resource usage as they are advertised.
Lets start with a bit of background - in Innodb row level locks are implemented by having special lock table, located in the buffer pool where small record allocated for each hash and for each row locked on that page bit can be set. This in theory can give overhead as low as few bits per row, so lets see how it looks in practice:
I used the same sample table as yesterday:
PLAIN TEXT SQL:
- CREATE TABLE `sample` (
- `i` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `j` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`i`),
- KEY `j` (`j`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
- mysql> SHOW TABLE STATUS LIKE "sample" …