List:Internals« Previous MessageNext Message »
From:Sergey Petrunia Date:April 20 2005 11:55pm
Subject:bk commit into 5.0 tree (sergefp:1.1863) BUG#10037
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of psergey. When psergey 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.1863 05/04/21 01:55:33 sergefp@stripped +2 -0
  Fix for BUG#10037
  * Add 0.01 to cost of 'range'+'using index' scan to avoid optimizer choice races with 
    'index' scan.

  sql/opt_range.cc
    1.153 05/04/21 01:55:29 sergefp@stripped +4 -1
    Fix for BUG#10037
    * Add 0.01 to cost of 'range'+'using index' scan to avoid optimizer choice races with 
      'index' scan.
    * make QUICK_GROUP_MIN_MAX_SELECT handle the case where the source table is empty. 

  mysql-test/r/range.result
    1.33 05/04/21 01:55:29 sergefp@stripped +2 -2
    Update the test result after the changed cost

# 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:	sergefp
# Host:	newbox.mylan
# Root:	/home/psergey/mysql-5.0-21apr

--- 1.152/sql/opt_range.cc	2005-04-20 12:09:53 +04:00
+++ 1.153/sql/opt_range.cc	2005-04-21 01:55:29 +04:00
@@ -2257,7 +2257,8 @@
 			 param->table->file->ref_length) + 1);
   read_time=((double) (records+keys_per_block-1)/
              (double) keys_per_block);
-  return read_time;
+  /* Add 0.01 to avoid cost races between 'range' and 'index' */
+  return read_time + 0.01;
 }
 
 
@@ -7912,6 +7913,8 @@
   file->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */
   result= file->ha_index_init(index);
   result= file->index_last(record);
+  if (result == HA_ERR_END_OF_FILE)
+    DBUG_RETURN(0);
   if (result)
     DBUG_RETURN(result);
   if (quick_prefix_select && quick_prefix_select->reset())

--- 1.32/mysql-test/r/range.result	2005-04-17 02:10:40 +04:00
+++ 1.33/mysql-test/r/range.result	2005-04-21 01:55:29 +04:00
@@ -256,12 +256,12 @@
 explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ref	j1	j1	4	const	1	Using index
-1	SIMPLE	t1	range	i1	i1	4	NULL	7	Using where; Using index
+1	SIMPLE	t1	index	i1	i1	4	NULL	7	Using where; Using index
 explain select * from t1 force index(i1), t2 force index(j1) where 
 (t1.key1 <t2.keya + 1) and t2.keya=3;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ref	j1	j1	4	const	1	Using index
-1	SIMPLE	t1	range	i1	i1	4	NULL	7	Using where; Using index
+1	SIMPLE	t1	index	i1	i1	4	NULL	7	Using where; Using index
 DROP TABLE t1,t2;
 CREATE TABLE t1 (
 a int(11) default NULL,
Thread
bk commit into 5.0 tree (sergefp:1.1863) BUG#10037Sergey Petrunia20 Apr