|
| 1 | +# |
| 2 | +# Bug 84366: InnoDB index dives do not detect concurrent tree changes, return |
| 3 | +# bogus estimates |
| 4 | +# |
| 5 | +CREATE TABLE t1 (key1 INT NOT NULL, key2 INT NOT NULL, |
| 6 | +INDEX i1(key1), INDEX i2(key2)) ENGINE = InnoDB; |
| 7 | +SET @@GLOBAL.innodb_purge_stop_now = TRUE; |
| 8 | +ALTER TABLE t1 ADD keyC INT NOT NULL, ADD INDEX iC(keyC); |
| 9 | +UPDATE t1 SET keyC = key1; |
| 10 | +ANALYZE TABLE t1; |
| 11 | +Table Op Msg_type Msg_text |
| 12 | +test.t1 analyze status OK |
| 13 | +EXPLAIN SELECT * FROM t1 WHERE key1 = 1 OR key2 = 2 OR keyC = 12; |
| 14 | +id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 15 | +1 SIMPLE t1 NULL index_merge i1,i2,iC i1,i2,iC 4,4,4 NULL 3 100.00 Using union(i1,i2,iC); Using where |
| 16 | +Warnings: |
| 17 | +Note 1003 /* select#1 */ select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`key2` AS `key2`,`test`.`t1`.`keyC` AS `keyC` from `test`.`t1` where ((`test`.`t1`.`key1` = 1) or (`test`.`t1`.`key2` = 2) or (`test`.`t1`.`keyC` = 12)) |
| 18 | +SET DEBUG_SYNC = "btr_estimate_n_rows_in_range_between_dives SIGNAL estimate_ready WAIT_FOR estimate_finish"; |
| 19 | +EXPLAIN SELECT * FROM t1 WHERE key1 = 1 OR key2 = 2 OR keyC = 12; |
| 20 | +SET DEBUG_SYNC = "now WAIT_FOR estimate_ready"; |
| 21 | +SET @@GLOBAL.innodb_purge_run_now = TRUE; |
| 22 | +SET DEBUG_SYNC = "now SIGNAL estimate_finish"; |
| 23 | +id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 24 | +1 SIMPLE t1 NULL index_merge i1,i2,iC i1,i2,iC 4,4,4 NULL 3 100.00 Using union(i1,i2,iC); Using where |
| 25 | +Warnings: |
| 26 | +Note 1003 /* select#1 */ select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`key2` AS `key2`,`test`.`t1`.`keyC` AS `keyC` from `test`.`t1` where ((`test`.`t1`.`key1` = 1) or (`test`.`t1`.`key2` = 2) or (`test`.`t1`.`keyC` = 12)) |
| 27 | +EXPLAIN SELECT * FROM t1 WHERE key1=1 or key2=2 or keyC=12; |
| 28 | +id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 29 | +1 SIMPLE t1 NULL index_merge i1,i2,iC i1,i2,iC 4,4,4 NULL 3 100.00 Using union(i1,i2,iC); Using where |
| 30 | +Warnings: |
| 31 | +Note 1003 /* select#1 */ select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`key2` AS `key2`,`test`.`t1`.`keyC` AS `keyC` from `test`.`t1` where ((`test`.`t1`.`key1` = 1) or (`test`.`t1`.`key2` = 2) or (`test`.`t1`.`keyC` = 12)) |
| 32 | +DROP TABLE t1; |
0 commit comments