mirror of
https://github.com/MariaDB/server.git
synced 2025-07-05 12:42:17 +03:00
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
SELECT @@global.innodb_table_locks into @table_locks;
|
|
SET @@global.innodb_table_locks= OFF;
|
|
DROP TABLE IF EXISTS t1, t2;
|
|
SET autocommit=0;
|
|
SET autocommit=0;
|
|
connection default;
|
|
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1,123,1,123);
|
|
INSERT INTO t1 VALUES (2,124,2,124);
|
|
INSERT INTO t1 VALUES (3,125,3,125);
|
|
INSERT INTO t1 VALUES (4,126,4,126);
|
|
CREATE INDEX ixi ON t1 (i);
|
|
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES (1,123,1,123);
|
|
INSERT INTO t2 VALUES (2,124,2,124);
|
|
INSERT INTO t2 VALUES (3,125,3,125);
|
|
INSERT INTO t2 VALUES (4,126,4,126);
|
|
CREATE INDEX ixi ON t2 (i);
|
|
COMMIT;
|
|
SELECT @@global.tx_isolation;
|
|
@@global.tx_isolation
|
|
REPEATABLE-READ
|
|
EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
|
SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
|
i i
|
|
123 123
|
|
124 124
|
|
connection root1;
|
|
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|