diff options
author | unknown <igor@rurik.mysql.com> | 2006-05-11 19:47:00 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-05-11 19:47:00 -0700 |
commit | 5c6d923f3095f5eca3abaa5277350bec90e4970c (patch) | |
tree | 8cb368f539664f3d5f04cbd5173b20360e61f63a /mysql-test/r/select.result | |
parent | 60bb69aa04a1795d6c1156e9814ce446662a8967 (diff) | |
download | mariadb-git-5c6d923f3095f5eca3abaa5277350bec90e4970c.tar.gz |
Added a test case for bug #18940:in 5.0 the optimizer chose
a worse execution plan than in 4.1 for some queries.
It happened due the fact that at some conditions the
optimizer always preferred range or full index scan access
methods to lookup access methods even when the latter were much
cheaper.
The problem was not observed in 4.1 for the reported query
because the WHERE condition was not of a form that could
cause the problem.
Equality propagation introduced on 5.0 added an extra
predicate and changed the WHERE condition. The new condition
provoked the optimizer to make a bad choice.
The problem was fixed by the patch for bug 17379.
mysql-test/r/select.result:
Added a test case for bug #18940.
The problem was fixed by the patch for bug 17379.
mysql-test/t/select.test:
Added a test case for bug #18940.
The problem was fixed by the patch for bug 17379.
Diffstat (limited to 'mysql-test/r/select.result')
-rw-r--r-- | mysql-test/r/select.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 3aae29a922e..335637b787f 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3427,3 +3427,22 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A range PRIMARY PRIMARY 12 NULL 3 Using where 1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 drop table t1, t2; +CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); +INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2), +(3,1), (5,1), (8,9), (2,2), (0,9); +CREATE TABLE t2 (c int, d int, f int, INDEX(c,f)); +INSERT INTO t2 VALUES +(1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1), +(5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1), +(0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1); +EXPLAIN +SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where +1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where +EXPLAIN +SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where +1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where +DROP TABLE t1, t2; |