{ "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select count(distinct `tt`.`a`) AS `count(distinct a)` from `tt`" } ] } }, { "join_optimization": { "select#": 1, "steps": [ { "table_dependencies": [ { "table": "`tt`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] } ] }, { "rows_estimation": [ { "table": "`tt`", "const_keys_added": { "keys": [ "PRIMARY", "d", "a" ], "cause": "indexed_distinct_aggregate" }, "range_analysis": { "table_scan": { "rows": 10462320, "cost": 2.12e6 }, "potential_range_indexes": [ { "index": "PRIMARY", "usable": true, "key_parts": [ "a", "b", "c", "d" ] }, { "index": "d", "usable": true, "key_parts": [ "d", "a", "b", "c" ] }, { "index": "a", "usable": true, "key_parts": [ "a", "b", "c", "d" ] } ], "best_covering_index_scan": { "index": "d", "cost": 2.12e6, "chosen": true }, "group_index_range": { "potential_group_range_indexes": [ { "index": "PRIMARY", "covering": true, "usable": false, "cause": "primary_key_is_clustered" }, { "index": "d", "covering": true }, { "index": "a", "covering": true, "rows": 2525, "cost": 3787.5 } ] }, "best_group_range_summary": { "type": "index_group", "index": "a", "group_attribute": null, "min_aggregate": false, "max_aggregate": false, "distinct_aggregate": true, "rows": 2525, "cost": 3787.5, "key_parts_used_for_access": [ "a" ], "ranges": [ ], "chosen": true }, "chosen_range_access_summary": { "range_access_plan": { "type": "index_group", "index": "a", "group_attribute": null, "min_aggregate": false, "max_aggregate": false, "distinct_aggregate": true, "rows": 2525, "cost": 3787.5, "key_parts_used_for_access": [ "a" ], "ranges": [ ] }, "rows_for_plan": 2525, "cost_for_plan": 3787.5, "chosen": true } } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`tt`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 2525, "access_type": "range", "range_details": { "used_index": "index_for_group_by(a)" }, "resulting_rows": 2525, "cost": 4292.5, "chosen": true } ] }, "condition_filtering_pct": 100, "rows_for_plan": 2525, "cost_for_plan": 4292.5, "chosen": true } ] }, { "attaching_conditions_to_tables": { "original_condition": null, "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`tt`", "attached": null } ] } }, { "refine_plan": [ { "table": "`tt`" } ] } ] } }, { "join_execution": { "select#": 1, "steps": [ ] } } ] }