diff options
author | Igor Babaev <igor@askmonty.org> | 2011-11-12 03:57:46 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-11-12 03:57:46 -0800 |
commit | db0aed93482759844af7b39c9bf6e7fe141f28f6 (patch) | |
tree | ba326379d7c2bce919cc9bf50f7fcc721477cb04 /mysql-test | |
parent | 7ab789ef33cd3ce30abd9d1cb45709fb894660a6 (diff) | |
parent | 28b2eaa81a2209d3c268e34db0046f4dc7c8d4fe (diff) | |
download | mariadb-git-db0aed93482759844af7b39c9bf6e7fe141f28f6.tar.gz |
Merge.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/range_vs_index_merge.result | 37 | ||||
-rw-r--r-- | mysql-test/r/range_vs_index_merge_innodb.result | 37 | ||||
-rwxr-xr-x | mysql-test/t/range_vs_index_merge.test | 29 |
3 files changed, 103 insertions, 0 deletions
diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result index 08ede868ed6..f1838bc9aae 100644 --- a/mysql-test/r/range_vs_index_merge.result +++ b/mysql-test/r/range_vs_index_merge.result @@ -1377,4 +1377,41 @@ SELECT * FROM t1,t2,t3 WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4; f1 f1 f2 f3 f4 f1 f2 DROP TABLE t1,t2,t3; +CREATE TABLE t1 ( +a int, b int, c int, d int, +PRIMARY KEY(b), INDEX idx1(d), INDEX idx2(d,b,c) +); +INSERT INTO t1 VALUES +(0,58,7,7),(0,63,2,0),(0,64,186,8),(0,65,1,-2), (0,71,190,-3), +(0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3); +SET SESSION optimizer_switch='index_merge_sort_union=off'; +EXPLAIN +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +a b c d +0 58 7 7 +0 64 186 8 +0 73 0 3 +0 74 5 25 +0 75 5 3 +SET SESSION optimizer_switch='index_merge_sort_union=on'; +EXPLAIN +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +a b c d +0 58 7 7 +0 64 186 8 +0 73 0 3 +0 74 5 25 +0 75 5 3 +SET SESSION optimizer_switch=DEFAULT; +DROP TABLE t1; set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result index 54151a7c2db..82297158c8c 100644 --- a/mysql-test/r/range_vs_index_merge_innodb.result +++ b/mysql-test/r/range_vs_index_merge_innodb.result @@ -1378,5 +1378,42 @@ SELECT * FROM t1,t2,t3 WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4; f1 f1 f2 f3 f4 f1 f2 DROP TABLE t1,t2,t3; +CREATE TABLE t1 ( +a int, b int, c int, d int, +PRIMARY KEY(b), INDEX idx1(d), INDEX idx2(d,b,c) +); +INSERT INTO t1 VALUES +(0,58,7,7),(0,63,2,0),(0,64,186,8),(0,65,1,-2), (0,71,190,-3), +(0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3); +SET SESSION optimizer_switch='index_merge_sort_union=off'; +EXPLAIN +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +a b c d +0 58 7 7 +0 64 186 8 +0 73 0 3 +0 74 5 25 +0 75 5 3 +SET SESSION optimizer_switch='index_merge_sort_union=on'; +EXPLAIN +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +SELECT * FROM t1 +WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +a b c d +0 58 7 7 +0 64 186 8 +0 73 0 3 +0 74 5 25 +0 75 5 3 +SET SESSION optimizer_switch=DEFAULT; +DROP TABLE t1; set session optimizer_switch='index_merge_sort_intersection=default'; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test index 1f7065dcb0a..2ffa2d8eb49 100755 --- a/mysql-test/t/range_vs_index_merge.test +++ b/mysql-test/t/range_vs_index_merge.test @@ -1029,5 +1029,34 @@ SELECT * FROM t1,t2,t3 DROP TABLE t1,t2,t3; +# +# LP bug #823301: index merge union with prossible index scan +# +# + +CREATE TABLE t1 ( + a int, b int, c int, d int, + PRIMARY KEY(b), INDEX idx1(d), INDEX idx2(d,b,c) +); +INSERT INTO t1 VALUES + (0,58,7,7),(0,63,2,0),(0,64,186,8),(0,65,1,-2), (0,71,190,-3), + (0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3); + +SET SESSION optimizer_switch='index_merge_sort_union=off'; +EXPLAIN +SELECT * FROM t1 + WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +SELECT * FROM t1 + WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +SET SESSION optimizer_switch='index_merge_sort_union=on'; +EXPLAIN +SELECT * FROM t1 + WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +SELECT * FROM t1 + WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; +SET SESSION optimizer_switch=DEFAULT; + +DROP TABLE t1; + #the following command must be the last one in the file set session optimizer_switch='index_merge_sort_intersection=default'; |