mysql> SELECT * FROM information_schema.OPTIMIZER_TRACE \G *************************** 1. row *************************** QUERY: select * from test_ddl where addr="hangzhou" order by gmt_create limit 1 TRACE: { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select `test_ddl`.`id` AS `id`,`test_ddl`.`addr` AS `addr`,`test_ddl`.`name1` AS `name1`,`test_ddl`.`name` AS `name`,`test_ddl`.`gmt_create` AS `gmt_create` from `test_ddl` where (`test_ddl`.`addr` = 'hangzhou') order by `test_ddl`.`gmt_create` limit 1" } ] } }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "(`test_ddl`.`addr` = 'hangzhou')", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "multiple equal('hangzhou', `test_ddl`.`addr`)" }, { "transformation": "constant_propagation", "resulting_condition": "multiple equal('hangzhou', `test_ddl`.`addr`)" }, { "transformation": "trivial_condition_removal", "resulting_condition": "multiple equal('hangzhou', `test_ddl`.`addr`)" } ] } }, { "substitute_generated_columns": { } }, { "table_dependencies": [ { "table": "`test_ddl`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] } ] }, { "ref_optimizer_key_uses": [ { "table": "`test_ddl`", "field": "addr", "equals": "'hangzhou'", "null_rejecting": true } ] }, { "rows_estimation": [ { "table": "`test_ddl`", "range_analysis": { "table_scan": { "rows": 39, "cost": 6.25 }, "potential_range_indexes": [ { "index": "PRIMARY", "usable": false, "cause": "not_applicable" }, { "index": "idx_addr_name_name1", "usable": true, "key_parts": [ "addr", "id" ] }, { "index": "idx_name1", "usable": false, "cause": "not_applicable" }, { "index": "idx_gmt_create", "usable": false, "cause": "not_applicable" } ], "setup_range_conditions": [ ], "group_index_range": { "chosen": false, "cause": "not_group_by_or_distinct" }, "skip_scan_range": { "potential_skip_scan_indexes": [ { "index": "idx_addr_name_name1", "usable": false, "cause": "query_references_nonkey_column" } ] }, "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "idx_addr_name_name1", "ranges": [ "addr = 'hangzhou'" ], "index_dives_for_eq_ranges": true, "rowid_ordered": true, "using_mrr": false, "index_only": false, "in_memory": 1, "rows": 14, "cost": 5.16, "chosen": true } ], "analyzing_roworder_intersect": { "usable": false, "cause": "too_few_roworder_scans" } }, "chosen_range_access_summary": { "range_access_plan": { "type": "range_scan", "index": "idx_addr_name_name1", "rows": 14, "ranges": [ "addr = 'hangzhou'" ] }, "rows_for_plan": 14, "cost_for_plan": 5.16, "chosen": true } } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`test_ddl`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "idx_addr_name_name1", "rows": 14, "cost": 2.15, "chosen": true }, { "access_type": "range", "range_details": { "used_index": "idx_addr_name_name1" }, "chosen": false, "cause": "heuristic_index_cheaper" } ] }, "condition_filtering_pct": 100, "rows_for_plan": 14, "cost_for_plan": 2.15, "chosen": true } ] }, { "attaching_conditions_to_tables": { "original_condition": "(`test_ddl`.`addr` = 'hangzhou')", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`test_ddl`", "attached": "(`test_ddl`.`addr` = 'hangzhou')" } ] } }, { "optimizing_distinct_group_by_order_by": { "simplifying_order_by": { "original_clause": "`test_ddl`.`gmt_create`", "items": [ { "item": "`test_ddl`.`gmt_create`" } ], "resulting_clause_is_simple": true, "resulting_clause": "`test_ddl`.`gmt_create`" } } }, { "reconsidering_access_paths_for_index_ordering": { "clause": "ORDER BY", "steps": [ ], "index_order_summary": { "table": "`test_ddl`", "index_provides_order": true, "order_direction": "asc", "index": "idx_gmt_create", "plan_changed": true, "access_type": "index" } } }, { "finalizing_table_conditions": [ { "table": "`test_ddl`", "original_table_condition": "(`test_ddl`.`addr` = 'hangzhou')", "final_table_condition ": "(`test_ddl`.`addr` = 'hangzhou')" } ] }, { "refine_plan": [ { "table": "`test_ddl`" } ] }, { "considering_tmp_tables": [ ] } ] } }, { "join_execution": { "select#": 1, "steps": [ ] } } ] } MISSING_BYTES_BEYOND_MAX_MEM_SIZE: 0 INSUFFICIENT_PRIVILEGES: 0 1 row in set (0.01 sec)