List:Commits« Previous MessageNext Message »
From:kgeorge Date:April 30 2007 2:29pm
Subject:bk commit into 5.1 tree (gkodinov:1.2507)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge 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@stripped, 2007-04-30 15:29:00+03:00, gkodinov@stripped +3 -0
  Merge magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt
  into  magare.gmz:/home/kgeorge/mysql/work/B27531-5.1-opt
  MERGE: 1.1810.2883.1

  mysql-test/r/join.result@stripped, 2007-04-30 15:28:59+03:00, gkodinov@stripped +0 -0
    manual merge
    MERGE: 1.38.1.5

  mysql-test/t/join.test@stripped, 2007-04-30 15:28:59+03:00, gkodinov@stripped +1 -0
    manual merge
    MERGE: 1.32.1.5

  sql/sql_select.cc@stripped, 2007-04-30 15:27:09+03:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.312.152.1

# 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:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/work/B27531-5.1-opt/RESYNC

--- 1.516/sql/sql_select.cc	2007-04-29 16:47:36 +03:00
+++ 1.517/sql/sql_select.cc	2007-04-30 15:27:09 +03:00
@@ -6155,11 +6155,14 @@ make_join_readinfo(JOIN *join, ulonglong
       disable join cache because it will change the ordering of the results.
       Code handles sort table that is at any location (not only first after 
       the const tables) despite the fact that it's currently prohibited.
+      We must disable join cache if the first non-const table alone is
+      ordered. If there is a temp table the ordering is done as a last
+      operation and doesn't prevent join cache usage.
     */
-    if (!ordered_set && 
-        (table == join->sort_by_table &&
+    if (!ordered_set && !join->need_tmp &&
+        ((table == join->sort_by_table &&
          (!join->order || join->skip_sort_order)) ||
-        (join->sort_by_table == (TABLE *) 1 && i != join->const_tables))
+        (join->sort_by_table == (TABLE *) 1 && i != join->const_tables)))
       ordered_set= 1;
 
     tab->sorted= sorted;

--- 1.46/mysql-test/r/join.result	2007-04-29 16:46:03 +03:00
+++ 1.47/mysql-test/r/join.result	2007-04-30 15:28:59 +03:00
@@ -807,6 +807,56 @@ Handler_read_prev	0
 Handler_read_rnd	0
 Handler_read_rnd_next	5
 drop table t1, t2, t3;
+CREATE TABLE t1 (a int, b int default 0, c int default 1);
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 (a) SELECT a + 8 FROM t1;
+INSERT INTO t1 (a) SELECT a + 16 FROM t1;
+CREATE TABLE t2 (a int, d int, e int default 0);
+INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
+INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
+INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;
+EXPLAIN
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+ORDER BY t1.b, t1.c;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	32	Using temporary; Using filesort
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	16	Using where
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+ORDER BY t1.b, t1.c;
+e
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+DROP TABLE t1,t2;
 create table t1 (a int);
 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t2 (a int, b int, filler char(100), key(a), key(b));

--- 1.40/mysql-test/t/join.test	2007-04-29 11:11:06 +03:00
+++ 1.41/mysql-test/t/join.test	2007-04-30 15:28:59 +03:00
@@ -633,6 +633,30 @@ show status like 'Handler_read%'; 
 drop table t1, t2, t3;
 
 #
+# Bug #27531: Query performance degredation in 4.1.22 and greater
+#
+CREATE TABLE t1 (a int, b int default 0, c int default 1);
+
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 (a) SELECT a + 8 FROM t1;
+INSERT INTO t1 (a) SELECT a + 16 FROM t1;
+
+CREATE TABLE t2 (a int, d int, e int default 0);
+
+INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
+INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
+INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;
+
+# should use join cache
+EXPLAIN
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+  ORDER BY t1.b, t1.c;
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+  ORDER BY t1.b, t1.c;
+
+DROP TABLE t1,t2;
+
+#
 # BUG#14940: Make E(#rows) from "range" access be re-used by range optimizer
 #
 create table t1 (a int); 
Thread
bk commit into 5.1 tree (gkodinov:1.2507)kgeorge30 Apr