Commit 8a8c2272 authored by unknown's avatar unknown
Browse files

Fix for BUG#7266.


mysql-test/r/greedy_optimizer.result:
  Adjusted query costs accordingly.
sql/sql_select.cc:
  Someone added this 0.001 cost factor to best_extension_by_limited_search(), but forgot to
  add it to the old version of the optimizer - find_best().
parent f0f0e628
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t6.c62	1	Using index
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	821.838037
Last_query_cost	821.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	
@@ -141,7 +141,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t6.c62	1	Using index
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	821.838037
Last_query_cost	821.837037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	3	
@@ -153,7 +153,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t1.c16	1	Using index
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	794.838037
Last_query_cost	794.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	3	
@@ -165,7 +165,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t1.c16	1	Using index
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	794.838037
Last_query_cost	794.837037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	3	
@@ -177,7 +177,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t1.c16	1	Using where
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	794.838037
Last_query_cost	794.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	3	
@@ -189,7 +189,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1	SIMPLE	t7	eq_ref	PRIMARY	PRIMARY	4	test.t1.c16	1	Using where
show status like 'Last_query_cost';
Variable_name	Value
Last_query_cost	794.838037
Last_query_cost	794.837037
set optimizer_prune_level=0;
select @@optimizer_prune_level;
@@optimizer_prune_level
+1 −1
Original line number Diff line number Diff line
@@ -4252,7 +4252,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
    {
      memcpy((gptr) join->best_positions,(gptr) join->positions,
	     sizeof(POSITION)*idx);
      join->best_read=read_time;
      join->best_read= read_time - 0.001;
    }
    return;
  }