Current Path : /home/usr.opt/mysql57/mysql-test/suite/opt_trace/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/opt_trace/r/charset.result |
set @@session.end_markers_in_json=on; set @@session.optimizer_trace="enabled=on"; create table t1(a int); insert into t1 values(1); set names latin1; explain extended select '', _latin1'' from t1 limit 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL Warnings: Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. Note 1003 /* select#1 */ select '' AS ``,_latin1'\xC1\xC2\xC3\xC4\xC5' AS `` from `test`.`t1` limit 1 select (@query:=QUERY)+NULL, (@trace:=TRACE)+NULL from information_schema.OPTIMIZER_TRACE; (@query:=QUERY)+NULL (@trace:=TRACE)+NULL NULL NULL select @query, @trace; @query @trace explain extended select '', _latin1'' from t1 limit 1 { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select '' AS ``,_latin1'\\xC1\\xC2\\xC3\\xC4\\xC5' AS `` from `t1` limit 1" } ] /* steps */ } /* join_preparation */ }, { "join_optimization": { "select#": 1, "steps": [ { "table_dependencies": [ { "table": "`t1`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "rows_estimation": [ { "table": "`t1`", "table_scan": { "rows": 1, "cost": 1 } /* table_scan */ } ] /* rows_estimation */ }, { "considered_execution_plans": [ { "plan_prefix": [ ] /* plan_prefix */, "table": "`t1`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 1, "access_type": "scan", "resulting_rows": 1, "cost": 1.2, "chosen": true } ] /* considered_access_paths */ } /* best_access_path */, "condition_filtering_pct": 100, "rows_for_plan": 1, "cost_for_plan": 1.2, "chosen": true } ] /* considered_execution_plans */ }, { "attaching_conditions_to_tables": { "original_condition": null, "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ { "table": "`t1`", "attached": null } ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ { "table": "`t1`" } ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "join_explain": { "select#": 1, "steps": [ ] /* steps */ } /* join_explain */ } ] /* steps */ } set names utf8; select @query, @trace; @query @trace explain extended select 'ÁÂÃÄÅ', _latin1'ÁÂÃÄÅ' from t1 limit 1 { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select 'ÁÂÃÄÅ' AS `ÁÂÃÄÅ`,_latin1'\\xC1\\xC2\\xC3\\xC4\\xC5' AS `ÁÂÃÄÅ` from `t1` limit 1" } ] /* steps */ } /* join_preparation */ }, { "join_optimization": { "select#": 1, "steps": [ { "table_dependencies": [ { "table": "`t1`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "rows_estimation": [ { "table": "`t1`", "table_scan": { "rows": 1, "cost": 1 } /* table_scan */ } ] /* rows_estimation */ }, { "considered_execution_plans": [ { "plan_prefix": [ ] /* plan_prefix */, "table": "`t1`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 1, "access_type": "scan", "resulting_rows": 1, "cost": 1.2, "chosen": true } ] /* considered_access_paths */ } /* best_access_path */, "condition_filtering_pct": 100, "rows_for_plan": 1, "cost_for_plan": 1.2, "chosen": true } ] /* considered_execution_plans */ }, { "attaching_conditions_to_tables": { "original_condition": null, "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ { "table": "`t1`", "attached": null } ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ { "table": "`t1`" } ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "join_explain": { "select#": 1, "steps": [ ] /* steps */ } /* join_explain */ } ] /* steps */ } set names latin1; create view v1 as select '' as col from t1 limit 1; select * from v1 where v1.col = ''; col select (@query:=QUERY)+NULL, (@trace:=TRACE)+NULL from information_schema.OPTIMIZER_TRACE; (@query:=QUERY)+NULL (@trace:=TRACE)+NULL NULL NULL set names utf8; select @query, @trace; @query @trace select * from v1 where v1.col = 'ÁÂÃÄÅ' { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "join_preparation": { "select#": 2, "steps": [ { "expanded_query": "/* select#2 */ select 'ÁÂÃÄÅ' AS `col` from `t1` limit 1" } ] /* steps */ } /* join_preparation */ }, { "view": { "table": "`v1`", "select#": 2, "materialized": true } /* view */ }, { "expanded_query": "/* select#1 */ select `v1`.`col` AS `col` from `v1` where (`v1`.`col` = 'ÁÂÃÄÅ')" } ] /* steps */ } /* join_preparation */ }, { "join_optimization": { "select#": 1, "steps": [ { "join_optimization": { "select#": 2, "steps": [ { "table_dependencies": [ { "table": "`t1`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "rows_estimation": [ { "table": "`t1`", "table_scan": { "rows": 1, "cost": 1 } /* table_scan */ } ] /* rows_estimation */ }, { "considered_execution_plans": [ { "plan_prefix": [ ] /* plan_prefix */, "table": "`t1`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 1, "access_type": "scan", "resulting_rows": 1, "cost": 1.2, "chosen": true } ] /* considered_access_paths */ } /* best_access_path */, "condition_filtering_pct": 100, "rows_for_plan": 1, "cost_for_plan": 1.2, "chosen": true } ] /* considered_execution_plans */ }, { "attaching_conditions_to_tables": { "original_condition": null, "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ { "table": "`t1`", "attached": null } ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ { "table": "`t1`" } ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "creating_tmp_table": { "tmp_table_info": { "table": "`v1`", "row_length": 7, "key_length": 0, "unique_constraint": false, "location": "memory (heap)", "row_limit_estimate": 149796 } /* tmp_table_info */ } /* creating_tmp_table */ }, { "join_execution": { "select#": 2, "steps": [ ] /* steps */ } /* join_execution */ }, { "condition_processing": { "condition": "WHERE", "original_condition": "(`v1`.`col` = 'ÁÂÃÄÅ')", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "multiple equal('ÁÂÃÄÅ', `v1`.`col`)" }, { "transformation": "constant_propagation", "resulting_condition": "multiple equal('ÁÂÃÄÅ', `v1`.`col`)" }, { "transformation": "trivial_condition_removal", "resulting_condition": "multiple equal('ÁÂÃÄÅ', `v1`.`col`)" } ] /* steps */ } /* condition_processing */ }, { "substitute_generated_columns": { } /* substitute_generated_columns */ }, { "table_dependencies": [ { "table": "`v1`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "ref_optimizer_key_uses": [ ] /* ref_optimizer_key_uses */ }, { "rows_estimation": [ { "table": "`v1`", "rows": 1, "cost": 1, "table_type": "system", "empty": false } ] /* rows_estimation */ }, { "condition_on_constant_tables": "1", "condition_value": true }, { "attaching_conditions_to_tables": { "original_condition": "1", "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "join_execution": { "select#": 1, "steps": [ ] /* steps */ } /* join_execution */ } ] /* steps */ } drop table t1; drop view v1; set names latin1; create table t1(c char(4) primary key); insert into t1 values ('aaa'), (''); select * from t1 where c < ''; c aaa select (@query:=QUERY)+NULL, (@trace:=TRACE)+NULL from information_schema.OPTIMIZER_TRACE; (@query:=QUERY)+NULL (@trace:=TRACE)+NULL NULL NULL set names utf8; select @query, @trace; @query @trace select * from t1 where c < 'ÁÂÃÄÅ' { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select `t1`.`c` AS `c` from `t1` where (`t1`.`c` < 'ÁÂÃÄÅ')" } ] /* steps */ } /* join_preparation */ }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "(`t1`.`c` < 'ÁÂÃÄÅ')", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "(`t1`.`c` < 'ÁÂÃÄÅ')" }, { "transformation": "constant_propagation", "resulting_condition": "(`t1`.`c` < 'ÁÂÃÄÅ')" }, { "transformation": "trivial_condition_removal", "resulting_condition": "(`t1`.`c` < 'ÁÂÃÄÅ')" } ] /* steps */ } /* condition_processing */ }, { "substitute_generated_columns": { } /* substitute_generated_columns */ }, { "table_dependencies": [ { "table": "`t1`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "ref_optimizer_key_uses": [ ] /* ref_optimizer_key_uses */ }, { "rows_estimation": [ { "table": "`t1`", "range_analysis": { "table_scan": { "rows": 2, "cost": 3.5 } /* table_scan */, "potential_range_indexes": [ { "index": "PRIMARY", "usable": true, "key_parts": [ "c" ] /* key_parts */ } ] /* potential_range_indexes */, "best_covering_index_scan": { "index": "PRIMARY", "cost": 1.401, "chosen": true } /* best_covering_index_scan */, "setup_range_conditions": [ ] /* setup_range_conditions */, "group_index_range": { "chosen": false, "cause": "not_group_by_or_distinct" } /* group_index_range */, "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "PRIMARY", "ranges": [ "c <= ÁÂÃÄ" ] /* ranges */, "index_dives_for_eq_ranges": true, "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 2, "cost": 2.41, "chosen": false, "cause": "cost" } ] /* range_scan_alternatives */, "analyzing_roworder_intersect": { "usable": false, "cause": "too_few_roworder_scans" } /* analyzing_roworder_intersect */ } /* analyzing_range_alternatives */ } /* range_analysis */ } ] /* rows_estimation */ }, { "considered_execution_plans": [ { "plan_prefix": [ ] /* plan_prefix */, "table": "`t1`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 2, "access_type": "scan", "resulting_rows": 2, "cost": 1.4, "chosen": true } ] /* considered_access_paths */ } /* best_access_path */, "condition_filtering_pct": 100, "rows_for_plan": 2, "cost_for_plan": 1.4, "chosen": true } ] /* considered_execution_plans */ }, { "attaching_conditions_to_tables": { "original_condition": "(`t1`.`c` < 'ÁÂÃÄÅ')", "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ { "table": "`t1`", "attached": "(`t1`.`c` < 'ÁÂÃÄÅ')" } ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ { "table": "`t1`" } ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "join_execution": { "select#": 1, "steps": [ ] /* steps */ } /* join_execution */ } ] /* steps */ } drop table t1; create table `t 1 a`(`col 1 a` int, index `index 1 a` (`col 1 a`)); insert into `t 1 a` values(2),(3); create view `v 1 a` as select * from `t 1 a`; select `col 1 a` from `v 1 a` where `col 1 a` < 6; col 1 a 2 3 select query, trace from information_schema.OPTIMIZER_TRACE; query trace select `col 1 a` from `v 1 a` where `col 1 a` < 6 { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "join_preparation": { "select#": 2, "steps": [ { "expanded_query": "/* select#2 */ select `t\n1\ta`.`col\n1\ta` AS `col\n1\ta` from `t\n1\ta`" } ] /* steps */ } /* join_preparation */ }, { "view": { "table": "`v\n1\ta`", "select#": 2, "merged": true } /* view */ }, { "expanded_query": "/* select#1 */ select `t\n1\ta`.`col\n1\ta` AS `col\n1\ta` from (`t\n1\ta`) where (`t\n1\ta`.`col\n1\ta` < 6)" }, { "transformations_to_nested_joins": { "transformations": [ "parenthesis_removal" ] /* transformations */, "expanded_query": "/* select#1 */ select `t\n1\ta`.`col\n1\ta` AS `col\n1\ta` from `t\n1\ta` where (`t\n1\ta`.`col\n1\ta` < 6)" } /* transformations_to_nested_joins */ } ] /* steps */ } /* join_preparation */ }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "(`t\n1\ta`.`col\n1\ta` < 6)", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "(`t\n1\ta`.`col\n1\ta` < 6)" }, { "transformation": "constant_propagation", "resulting_condition": "(`t\n1\ta`.`col\n1\ta` < 6)" }, { "transformation": "trivial_condition_removal", "resulting_condition": "(`t\n1\ta`.`col\n1\ta` < 6)" } ] /* steps */ } /* condition_processing */ }, { "substitute_generated_columns": { } /* substitute_generated_columns */ }, { "table_dependencies": [ { "table": "`t\n1\ta`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] /* depends_on_map_bits */ } ] /* table_dependencies */ }, { "ref_optimizer_key_uses": [ ] /* ref_optimizer_key_uses */ }, { "rows_estimation": [ { "table": "`t\n1\ta`", "range_analysis": { "table_scan": { "rows": 2, "cost": 3.5 } /* table_scan */, "potential_range_indexes": [ { "index": "index\n1\ta", "usable": true, "key_parts": [ "col\n1\ta" ] /* key_parts */ } ] /* potential_range_indexes */, "best_covering_index_scan": { "index": "index\n1\ta", "cost": 1.4013, "chosen": true } /* best_covering_index_scan */, "setup_range_conditions": [ ] /* setup_range_conditions */, "group_index_range": { "chosen": false, "cause": "not_group_by_or_distinct" } /* group_index_range */, "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "index\n1\ta", "ranges": [ "NULL < col\n1\ta < 6" ] /* ranges */, "index_dives_for_eq_ranges": true, "rowid_ordered": false, "using_mrr": false, "index_only": true, "rows": 2, "cost": 1.4113, "chosen": false, "cause": "cost" } ] /* range_scan_alternatives */, "analyzing_roworder_intersect": { "usable": false, "cause": "too_few_roworder_scans" } /* analyzing_roworder_intersect */ } /* analyzing_range_alternatives */ } /* range_analysis */ } ] /* rows_estimation */ }, { "considered_execution_plans": [ { "plan_prefix": [ ] /* plan_prefix */, "table": "`t\n1\ta`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 2, "access_type": "scan", "resulting_rows": 2, "cost": 1.4, "chosen": true } ] /* considered_access_paths */ } /* best_access_path */, "condition_filtering_pct": 100, "rows_for_plan": 2, "cost_for_plan": 1.4, "chosen": true } ] /* considered_execution_plans */ }, { "attaching_conditions_to_tables": { "original_condition": "(`t\n1\ta`.`col\n1\ta` < 6)", "attached_conditions_computation": [ ] /* attached_conditions_computation */, "attached_conditions_summary": [ { "table": "`t\n1\ta`", "attached": "(`t\n1\ta`.`col\n1\ta` < 6)" } ] /* attached_conditions_summary */ } /* attaching_conditions_to_tables */ }, { "refine_plan": [ { "table": "`t\n1\ta`" } ] /* refine_plan */ } ] /* steps */ } /* join_optimization */ }, { "join_execution": { "select#": 1, "steps": [ ] /* steps */ } /* join_execution */ } ] /* steps */ } drop table `t 1 a`; drop view `v 1 a`; set optimizer_trace=default;