summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_outer.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2014-10-29 01:20:45 +0300
committerSergey Petrunya <psergey@askmonty.org>2014-10-29 01:20:45 +0300
commit94c8f33569ec2b8094928463150567d4dcf67398 (patch)
tree5593e8272c103e29142a401d292a079c9886ed25 /mysql-test/t/join_outer.test
parent5023bb899dfaf78d85be2e6c08ec22cadcbcf82a (diff)
downloadmariadb-git-94c8f33569ec2b8094928463150567d4dcf67398.tar.gz
MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled
- TABLE::create_key_part_by_field() should not set PART_KEY_FLAG in field->flags = The reason is that it is used by hash join code which calls it to create a hash table lookup structure. It doesn't create a real index. = Another caller of the function is TABLE::add_tmp_key(). Made it to set the flag itself. - The differences in join_cache.result could also be observed before this patch: one could put "FLUSH TABLES" before the queries and get exactly the same difference.
Diffstat (limited to 'mysql-test/t/join_outer.test')
-rw-r--r--mysql-test/t/join_outer.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 006df9f0359..184142361a2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1463,4 +1463,28 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
DROP TABLE t1,t2,t3;
+--echo #
+--echo # Bug mdev-6705: wrong on expression after constant row substitution
+--echo # that triggers a simplification of WHERE condition
+--echo #
+
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (10,8);
+
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8),(9);
+
+CREATE TABLE t3 (d int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (3),(8);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
+ WHERE b IN (1,2,3) OR b = d;
+
+SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
+ WHERE b IN (1,2,3) OR b = d;
+
+DROP TABLE t1,t2,t3;
+
+
SET optimizer_switch=@save_optimizer_switch;