{ "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "join_preparation": { "select#": 2, "steps": [ { "expanded_query": "/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)" } ] } }, { "expanded_query": "/* select#1 */ select distinct `sa`.`attribute` AS `attribute` from `sample_attribute` `sa` where ((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological') order by `sa`.`attribute`" } ] } }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')", "steps": [ { "transformation": "equality_propagation", "subselect_evaluation": [ ], "resulting_condition": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')" }, { "transformation": "constant_propagation", "subselect_evaluation": [ ], "resulting_condition": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')" }, { "transformation": "trivial_condition_removal", "subselect_evaluation": [ ], "resulting_condition": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')" } ] } }, { "table_dependencies": [ { "table": "`sample_attribute` `sa`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] } ] }, { "ref_optimizer_key_uses": [ ] }, { "rows_estimation": [ { "table": "`sample_attribute` `sa`", "const_keys_added": { "keys": [ "sample_attribute_unique" ], "cause": "distinct" }, "range_analysis": { "table_scan": { "rows": 4050340, "cost": 824901 }, "potential_range_indices": [ { "index": "PRIMARY", "usable": false, "cause": "not_applicable" }, { "index": "sample_attribute_unique", "usable": true, "key_parts": [ "attribute", "sample_id" ] }, { "index": "sample_attribute_FKIndex1", "usable": false, "cause": "not_applicable" } ], "best_covering_index_scan": { "index": "sample_attribute_unique", "cost": 1.18e6, "chosen": false, "cause": "cost" }, "setup_range_conditions": [ ], "group_index_range": { "distinct_query": true, "potential_group_range_indices": [ { "index": "PRIMARY", "usable": false, "cause": "not_covering" }, { "index": "sample_attribute_unique", "covering": true, "rows": 107, "cost": 203.3 }, { "index": "sample_attribute_FKIndex1", "usable": false, "cause": "not_covering" } ] }, "best_group_range_summary": { "type": "index_group", "index": "sample_attribute_unique", "group_attribute": null, "min_aggregate": false, "max_aggregate": false, "distinct_aggregate": false, "rows": 107, "cost": 203.3, "key_parts_used_for_access": [ "attribute" ], "ranges": [ ], "chosen": true }, "chosen_range_access_summary": { "range_access_plan": { "type": "index_group", "index": "sample_attribute_unique", "group_attribute": null, "min_aggregate": false, "max_aggregate": false, "distinct_aggregate": false, "rows": 107, "cost": 203.3, "key_parts_used_for_access": [ "attribute" ], "ranges": [ ] }, "rows_for_plan": 107, "cost_for_plan": 203.3, "chosen": true } } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`sample_attribute` `sa`", "best_access_path": { "considered_access_paths": [ { "access_type": "range", "rows": 107, "cost": 224.7, "chosen": true, "use_tmp_table": true } ] }, "cost_for_plan": 224.7, "rows_for_plan": 107, "sort_cost": 107, "new_cost_for_plan": 331.7, "chosen": true } ] }, { "attaching_conditions_to_tables": { "original_condition": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`sample_attribute` `sa`", "attached": "((/* select#2 */ select `sk`.`category` from (`sample` `s` join `sample_kind` `sk` on((`sk`.`id` = `s`.`sample_kind_id`))) where (`s`.`id` = `sa`.`sample_id`)) = 'physiological')" } ] } }, { "clause_processing": { "clause": "ORDER BY", "original_clause": "`sa`.`attribute`", "items": [ { "item": "`sa`.`attribute`" } ], "resulting_clause_is_simple": true, "resulting_clause": "`sa`.`attribute`" } }, { "reconsidering_access_paths_for_index_ordering": { "clause": "ORDER BY", "index_order_summary": { "table": "`sample_attribute` `sa`", "index_provides_order": true, "order_direction": "asc", "index": "sample_attribute_unique", "plan_changed": false } } }, { "reconsidering_access_paths_for_index_ordering": { "clause": "GROUP BY", "index_order_summary": { "table": "`sample_attribute` `sa`", "index_provides_order": true, "order_direction": "asc", "index": "sample_attribute_unique", "plan_changed": false } } }, { "clause_processing": { "clause": "GROUP BY", "original_clause": "`sa`.`attribute`", "items": [ { "item": "`sa`.`attribute`" } ], "resulting_clause_is_simple": true, "resulting_clause": "`sa`.`attribute`" } }, { "refine_plan": [ { "table": "`sample_attribute` `sa`", "access_type": "range" } ] }, { "reconsidering_access_paths_for_index_ordering": { "clause": "GROUP BY", "index_order_summary": { "table": "`sample_attribute` `sa`", "index_provides_order": true, "order_direction": "asc", "index": "sample_attribute_unique", "plan_changed": false } } } ] } }, { "join_explain": { "select#": 1, "steps": [ { "join_optimization": { "select#": 2, "steps": [ { "transformations_to_nested_joins": { "transformations": [ "JOIN_condition_to_WHERE", "parenthesis_removal" ], "expanded_query": "/* select#2 */ select `sk`.`category` from `sample` `s` join `sample_kind` `sk` where ((`s`.`id` = `sa`.`sample_id`) and (`sk`.`id` = `s`.`sample_kind_id`))" } }, { "condition_processing": { "condition": "WHERE", "original_condition": "((`s`.`id` = `sa`.`sample_id`) and (`sk`.`id` = `s`.`sample_kind_id`))", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "((`s`.`id` = `sa`.`sample_id`) and multiple equal(`sk`.`id`, `s`.`sample_kind_id`))" }, { "transformation": "constant_propagation", "resulting_condition": "((`s`.`id` = `sa`.`sample_id`) and multiple equal(`sk`.`id`, `s`.`sample_kind_id`))" }, { "transformation": "trivial_condition_removal", "resulting_condition": "((`s`.`id` = `sa`.`sample_id`) and multiple equal(`sk`.`id`, `s`.`sample_kind_id`))" } ] } }, { "table_dependencies": [ { "table": "`sample` `s`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] }, { "table": "`sample_kind` `sk`", "row_may_be_null": false, "map_bit": 1, "depends_on_map_bits": [ ] } ] }, { "ref_optimizer_key_uses": [ { "table": "`sample` `s`", "field": "id", "equals": "`sa`.`sample_id`", "null_rejecting": false }, { "table": "`sample` `s`", "field": "sample_kind_id", "equals": "`sk`.`id`", "null_rejecting": false }, { "table": "`sample` `s`", "field": "id", "equals": "`sa`.`sample_id`", "null_rejecting": false }, { "table": "`sample_kind` `sk`", "field": "id", "equals": "`s`.`sample_kind_id`", "null_rejecting": false } ] }, { "rows_estimation": [ { "table": "`sample` `s`", "table_scan": { "rows": 5244386, "cost": 77120 } }, { "table": "`sample_kind` `sk`", "table_scan": { "rows": 63, "cost": 1 } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`sample_kind` `sk`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "PRIMARY", "usable": false, "chosen": false }, { "access_type": "scan", "rows": 63, "cost": 13.6, "chosen": true } ] }, "cost_for_plan": 13.6, "rows_for_plan": 63, "rest_of_plan": [ { "plan_prefix": [ "`sample_kind` `sk`" ], "table": "`sample` `s`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "PRIMARY", "rows": 1, "cost": 1.2, "chosen": true }, { "access_type": "ref", "index": "sample_kind_id", "rows": 1, "cost": 63.2, "chosen": false }, { "access_type": "scan", "cost": 1.13e6, "rows": 5244386, "cause": "cost", "chosen": false } ] }, "cost_for_plan": 27.2, "rows_for_plan": 63, "chosen": true } ] }, { "plan_prefix": [ ], "table": "`sample` `s`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "PRIMARY", "rows": 1, "cost": 1.2, "chosen": true }, { "access_type": "ref", "index": "sample_kind_id", "rows": 1, "cost": 1.4, "chosen": false }, { "access_type": "scan", "cost": 1.13e6, "rows": 5244386, "cause": "cost", "chosen": false } ] }, "cost_for_plan": 1.2, "rows_for_plan": 1, "rest_of_plan": [ { "plan_prefix": [ "`sample` `s`" ], "table": "`sample_kind` `sk`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "PRIMARY", "rows": 1, "cost": 1.2, "chosen": true }, { "access_type": "scan", "cost": 13.6, "rows": 63, "cause": "cost", "chosen": false } ] }, "added_to_eq_ref_extension": true, "cost_for_plan": 2.4, "rows_for_plan": 1, "chosen": true } ] } ] }, { "attaching_conditions_to_tables": { "original_condition": "((`sk`.`id` = `s`.`sample_kind_id`) and (`s`.`id` = `sa`.`sample_id`))", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`sample` `s`", "attached": null }, { "table": "`sample_kind` `sk`", "attached": null } ] } }, { "refine_plan": [ { "table": "`sample` `s`" }, { "table": "`sample_kind` `sk`" } ] } ] } }, { "join_explain": { "select#": 2, "steps": [ ] } } ] } } ] }