Re: why UPDATE requires share lock(S) for table joined
Posted by:
Mike Chen
Date: November 14, 2014 03:07AM
hi Rick ,
here they are :
mysql> show create table lktest;
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| lktest | CREATE TABLE `lktest` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` char(100) NOT NULL DEFAULT 'data',
`c3` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `c3` (`c3`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 |
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show create table t;
+-------+-----------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`x` int(11) NOT NULL,
`y` int(11) DEFAULT NULL,
PRIMARY KEY (`x`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
# id, select_type, table, type, possible_keys, key, key_len, ref, rows, Extra
'1', 'SIMPLE', 't', 'const', 'PRIMARY', 'PRIMARY', '4', 'const', '1', ''
'1', 'SIMPLE', 'lktest', 'ref', ' c3', 'c3', '5', 'const', '2', 'Using where'