mariadb/mysql-test/r/greedy_optimizer.result

740 lines
44 KiB
Text
Raw Normal View History

Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
drop table if exists t1,t2,t3,t4,t5,t6,t7;
2011-12-15 23:26:59 +01:00
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=1;
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
create table t1 (
c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
primary key (c11)
);
create table t2 (
c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
);
create table t3 (
c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
primary key (c31)
);
create table t4 (
c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
);
create table t5 (
c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
primary key (c51)
);
create table t6 (
c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
);
create table t7 (
c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
primary key (c71)
);
insert into t1 values (1,2,3,4,5,6);
insert into t1 values (2,2,3,4,5,6);
insert into t1 values (3,2,3,4,5,6);
insert into t2 values (1,2,3,4,5,6);
insert into t2 values (2,2,3,4,5,6);
insert into t2 values (3,2,3,4,5,6);
insert into t2 values (4,2,3,4,5,6);
insert into t2 values (5,2,3,4,5,6);
insert into t2 values (6,2,3,4,5,6);
insert into t3 values (1,2,3,4,5,6);
insert into t3 values (2,2,3,4,5,6);
insert into t3 values (3,2,3,4,5,6);
insert into t3 values (4,2,3,4,5,6);
insert into t3 values (5,2,3,4,5,6);
insert into t3 values (6,2,3,4,5,6);
insert into t3 values (7,2,3,4,5,6);
insert into t3 values (8,2,3,4,5,6);
insert into t3 values (9,2,3,4,5,6);
insert into t4 values (1,2,3,4,5,6);
insert into t4 values (2,2,3,4,5,6);
insert into t4 values (3,2,3,4,5,6);
insert into t4 values (4,2,3,4,5,6);
insert into t4 values (5,2,3,4,5,6);
insert into t4 values (6,2,3,4,5,6);
insert into t4 values (7,2,3,4,5,6);
insert into t4 values (8,2,3,4,5,6);
insert into t4 values (9,2,3,4,5,6);
insert into t4 values (10,2,3,4,5,6);
insert into t4 values (11,2,3,4,5,6);
insert into t4 values (12,2,3,4,5,6);
insert into t5 values (1,2,3,4,5,6);
insert into t5 values (2,2,3,4,5,6);
insert into t5 values (3,2,3,4,5,6);
insert into t5 values (4,2,3,4,5,6);
insert into t5 values (5,2,3,4,5,6);
insert into t5 values (6,2,3,4,5,6);
insert into t5 values (7,2,3,4,5,6);
insert into t5 values (8,2,3,4,5,6);
insert into t5 values (9,2,3,4,5,6);
insert into t5 values (10,2,3,4,5,6);
insert into t5 values (11,2,3,4,5,6);
insert into t5 values (12,2,3,4,5,6);
insert into t5 values (13,2,3,4,5,6);
insert into t5 values (14,2,3,4,5,6);
insert into t5 values (15,2,3,4,5,6);
insert into t6 values (1,2,3,4,5,6);
insert into t6 values (2,2,3,4,5,6);
insert into t6 values (3,2,3,4,5,6);
insert into t6 values (4,2,3,4,5,6);
insert into t6 values (5,2,3,4,5,6);
insert into t6 values (6,2,3,4,5,6);
insert into t6 values (7,2,3,4,5,6);
insert into t6 values (8,2,3,4,5,6);
insert into t6 values (9,2,3,4,5,6);
insert into t6 values (10,2,3,4,5,6);
insert into t6 values (11,2,3,4,5,6);
insert into t6 values (12,2,3,4,5,6);
insert into t6 values (13,2,3,4,5,6);
insert into t6 values (14,2,3,4,5,6);
insert into t6 values (15,2,3,4,5,6);
insert into t6 values (16,2,3,4,5,6);
insert into t6 values (17,2,3,4,5,6);
insert into t6 values (18,2,3,4,5,6);
insert into t7 values (1,2,3,4,5,6);
insert into t7 values (2,2,3,4,5,6);
insert into t7 values (3,2,3,4,5,6);
insert into t7 values (4,2,3,4,5,6);
insert into t7 values (5,2,3,4,5,6);
insert into t7 values (6,2,3,4,5,6);
insert into t7 values (7,2,3,4,5,6);
insert into t7 values (8,2,3,4,5,6);
insert into t7 values (9,2,3,4,5,6);
insert into t7 values (10,2,3,4,5,6);
insert into t7 values (11,2,3,4,5,6);
insert into t7 values (12,2,3,4,5,6);
insert into t7 values (13,2,3,4,5,6);
insert into t7 values (14,2,3,4,5,6);
insert into t7 values (15,2,3,4,5,6);
insert into t7 values (16,2,3,4,5,6);
insert into t7 values (17,2,3,4,5,6);
insert into t7 values (18,2,3,4,5,6);
insert into t7 values (19,2,3,4,5,6);
insert into t7 values (20,2,3,4,5,6);
insert into t7 values (21,2,3,4,5,6);
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
62
select @@optimizer_prune_level;
@@optimizer_prune_level
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1
set optimizer_search_depth=63;
Warnings:
Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
select @@optimizer_search_depth;
@@optimizer_search_depth
63
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.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 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.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 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.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 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.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 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
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.837037
set optimizer_prune_level=0;
select @@optimizer_prune_level;
@@optimizer_prune_level
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
0
set optimizer_search_depth=0;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
0
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1371.437037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1371.437037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
set optimizer_search_depth=1;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
set optimizer_search_depth=62;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
62
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1371.437037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1371.437037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 t2 ALL NULL NULL NULL NULL 6 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 362.618727
set optimizer_prune_level=1;
select @@optimizer_prune_level;
@@optimizer_prune_level
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1
set optimizer_search_depth=0;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
0
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
set optimizer_search_depth=1;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
set optimizer_search_depth=62;
select @@optimizer_search_depth;
@@optimizer_search_depth
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
62
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 1693.637037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Bug #27531: 5.1 part of the fix - Renamed "Using join cache" to "Using join buffer". - "Using join buffer" is now printed on the last table that "reads" from the join buffer cache. mysql-test/r/archive_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ctype_utf8.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/derived.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/distinct.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/func_group_innodb.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/greedy_optimizer.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_by.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/group_min_max.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/index_merge_myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/information_schema.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/innodb_mysql.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/join_nested.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/key_diff.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/myisam.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_condition_pushdown.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ndb_gis.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/range.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/row.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/select.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/ssl_compress.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/subselect3.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/union.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. mysql-test/r/view.result: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch. sql/sql_select.cc: Bug #27531: renamed "Using join cache" to "Using join buffer" and moved to the last table in the batch.
2007-05-29 14:58:18 +02:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
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 Using where
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
show status like 'Last_query_cost';
Variable_name Value
Back-ported the patch of the mysql-5.6 code line that fixed several defects in the greedy optimization: 1) The greedy optimizer calculated the 'compare-cost' (CPU-cost) for iterating over the partial plan result at each level in the query plan as 'record_count / (double) TIME_FOR_COMPARE' This cost was only used locally for 'best' calculation at each level, and *not* accumulated into the total cost for the query plan. This fix added the 'CPU-cost' of processing 'current_record_count' records at each level to 'current_read_time' *before* it is used as 'accumulated cost' argument to recursive best_extension_by_limited_search() calls. This ensured that the cost of a huge join-fanout early in the QEP was correctly reflected in the cost of the final QEP. To get identical cost for a 'best' optimized query and a straight_join with the same join order, the same change was also applied to optimize_straight_join() and get_partial_join_cost() 2) Furthermore to get equal cost for 'best' optimized query and a straight_join the new code substrcated the same '0.001' in optimize_straight_join() as it had been already done in best_extension_by_limited_search() 3) When best_extension_by_limited_search() aggregated the 'best' plan a plan was 'best' by the check : 'if ((search_depth == 1) || (current_read_time < join->best_read))' The term '(search_depth == 1' incorrectly caused a new best plan to be collected whenever the specified 'search_depth' was reached - even if this partial query plan was more expensive than what we had already found.
2011-12-24 17:55:10 +01:00
Last_query_cost 844.037037
Implementation of WL#1469 (Greedy algorithm to search for an optimal execution plan). mysql-test/r/subselect.result: Table pre-sorting before optimization makes the optimizer select a different plan, this change fixes the plan. sql/mysql_priv.h: Added new status variable last_query_cost that contains the cost of the last compiled query. sql/mysqld.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. * Added new status variable 'last_query_cost' that contains the cost of the last compiled query. sql/set_var.cc: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_class.h: * Added new system variable 'plan_search_depth' to control the exhaustiveness of the search for an optimal query plan. * Added new system variable 'heuristic' to control the use of query optimization heuristic. sql/sql_select.cc: Added a combined greedy/exhaustive query optimization algorithm. * The greedy search algorithm is implemented in function 'greedy_search'. * The exhaustive search with controlled search depth is implemented in function 'find_best_limited_depth', a modification of 'find_best'. * The selection of the best access path and its cost computation is factored out from 'find_best' into function 'best_access_path'. * In addition: - added pre-sorting for the query tables before they get optimized - factored out the optimization of STRAIGHT_JOIN into a separate procedure sql/sql_select.h: Added new field to st_position to support the greedy optimizer. Added a comment to class JOIN. sql/sql_show.cc: Added a case to 'mysqld_show' to print double status variables. sql/structs.h: Added a new type of status variables SHOW_DOUBLE BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-16 12:21:08 +02:00
drop table t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a int, b int, d int, i int);
INSERT INTO t1 VALUES (1,1,1,1);
CREATE TABLE t2 (b int, c int, j int);
INSERT INTO t2 VALUES (1,1,1);
CREATE TABLE t2_1 (j int);
INSERT INTO t2_1 VALUES (1);
CREATE TABLE t3 (c int, f int);
INSERT INTO t3 VALUES (1,1);
CREATE TABLE t3_1 (f int);
INSERT INTO t3_1 VALUES (1);
CREATE TABLE t4 (d int, e int, k int);
INSERT INTO t4 VALUES (1,1,1);
CREATE TABLE t4_1 (k int);
INSERT INTO t4_1 VALUES (1);
CREATE TABLE t5 (g int, d int, h int, l int);
INSERT INTO t5 VALUES (1,1,1,1);
CREATE TABLE t5_1 (l int);
INSERT INTO t5_1 VALUES (1);
SET optimizer_search_depth = 3;
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
1
1
SELECT 1
FROM t1
LEFT JOIN (
t2 LEFT JOIN (t3 JOIN t3_1 ON t3.f = t3_1.f) ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
1
1
SELECT 1
FROM t1
LEFT JOIN (
(t2 JOIN t2_1 ON t2.j = t2_1.j) JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
1
1
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
(t4 JOIN t4_1 ON t4.k = t4_1.k) LEFT JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
1
1
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 LEFT JOIN (t5 JOIN t5_1 ON t5.l = t5_1.l) ON t5.d = t4.d
) ON t4.d = t1.d
;
1
1
SET optimizer_search_depth = DEFAULT;
DROP TABLE t1,t2,t2_1,t3,t3_1,t4,t4_1,t5,t5_1;
End of 5.0 tests
2011-12-15 23:26:59 +01:00
set join_cache_level=@save_join_cache_level;