List:Commits« Previous MessageNext Message »
From:igor Date:May 12 2006 2:47am
Subject:bk commit into 5.0 tree (igor:1.2126) BUG#18940
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2126 06/05/11 19:47:00 igor@stripped +2 -0
  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/t/select.test
    1.101 06/05/11 19:46:54 igor@stripped +21 -0
    Added a test case for bug #18940.
    The problem was fixed by the patch for bug 17379.

  mysql-test/r/select.result
    1.123 06/05/11 19:46:54 igor@stripped +19 -0
    Added a test case for bug #18940.
    The problem was fixed by the patch for bug 17379.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-5.0-2

--- 1.122/mysql-test/r/select.result	2006-05-10 06:40:15 -07:00
+++ 1.123/mysql-test/r/select.result	2006-05-11 19:46:54 -07:00
@@ -3427,3 +3427,22 @@
 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;

--- 1.100/mysql-test/t/select.test	2006-05-10 06:40:15 -07:00
+++ 1.101/mysql-test/t/select.test	2006-05-11 19:46:54 -07:00
@@ -2899,3 +2899,24 @@
 explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
           and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
 drop table t1, t2;
+
+#
+#Bug #18940: selection of optimal execution plan caused by equality
+#            propagation (the bug was fixed by the patch for bug #17379)
+
+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;
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
+
+DROP TABLE t1, t2;
Thread
bk commit into 5.0 tree (igor:1.2126) BUG#18940igor12 May