{ "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`" }, { "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`))" } } ] } }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "((/* 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`))) = 'physiological')", "steps": [ { "transformation": "equality_propagation", "subselect_evaluation": [ ], "resulting_condition": "((/* 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`))) = 'physiological')" }, { "transformation": "constant_propagation", "subselect_evaluation": [ ], "resulting_condition": "((/* 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`))) = 'physiological')" }, { "transformation": "trivial_condition_removal", "subselect_evaluation": [ ], "resulting_condition": "((/* 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`))) = 'physiological')" } ] } }, { "substitute_generated_columns": { } }, { "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": 4589163, "cost": 934396 }, "potential_range_indexes": [ { "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.34e6, "chosen": false, "cause": "cost" }, "setup_range_conditions": [ ], "group_index_range": { "distinct_query": true, "potential_group_range_indexes": [ { "index": "sample_attribute_unique", "covering": true, "usable": false, "cause": "keypart_reference_from_where_clause" } ] } } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`sample_attribute` `sa`", "best_access_path": { "considered_access_paths": [ { "rows_to_scan": 4589163, "access_type": "scan", "resulting_rows": 4.59e6, "cost": 934394, "chosen": true, "use_tmp_table": true } ] }, "condition_filtering_pct": 100, "rows_for_plan": 4.59e6, "cost_for_plan": 934394, "sort_cost": 4.59e6, "new_cost_for_plan": 5.52e6, "chosen": true } ] }, { "attaching_conditions_to_tables": { "original_condition": "((/* 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`))) = 'physiological')", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`sample_attribute` `sa`", "attached": "((/* 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`))) = '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`" } }, { "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 } } }, { "refine_plan": [ { "table": "`sample_attribute` `sa`" } ] } ] } }, { "join_optimization": { "select#": 2, "steps": [ { "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`))" } ] } }, { "substitute_generated_columns": { } }, { "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": 6166050, "cost": 75456 } }, { "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 }, { "rows_to_scan": 63, "access_type": "scan", "resulting_rows": 63, "cost": 13.6, "chosen": true } ] }, "condition_filtering_pct": 100, "rows_for_plan": 63, "cost_for_plan": 13.6, "rest_of_plan": [ { "plan_prefix": [ "`sample_kind` `sk`" ], "table": "`sample` `s`", "best_access_path": { "considered_access_paths": [ { "access_type": "eq_ref", "index": "PRIMARY", "rows": 1, "cost": 13.6, "chosen": true, "cause": "clustered_pk_chosen_by_heuristics" }, { "access_type": "scan", "cost": 1.31e6, "rows": 6166050, "chosen": false, "cause": "cost" } ] }, "condition_filtering_pct": 5, "rows_for_plan": 3.15, "cost_for_plan": 27.2, "chosen": true } ] }, { "plan_prefix": [ ], "table": "`sample` `s`", "best_access_path": { "considered_access_paths": [ { "access_type": "eq_ref", "index": "PRIMARY", "rows": 1, "cost": 1.2, "chosen": true, "cause": "clustered_pk_chosen_by_heuristics" }, { "access_type": "scan", "cost": 1.31e6, "rows": 6166050, "chosen": false, "cause": "cost" } ] }, "condition_filtering_pct": 100, "rows_for_plan": 1, "cost_for_plan": 1.2, "rest_of_plan": [ { "plan_prefix": [ "`sample` `s`" ], "table": "`sample_kind` `sk`", "best_access_path": { "considered_access_paths": [ { "access_type": "eq_ref", "index": "PRIMARY", "rows": 1, "cost": 1.2, "chosen": true, "cause": "clustered_pk_chosen_by_heuristics" }, { "access_type": "scan", "cost": 13.6, "rows": 63, "chosen": false, "cause": "cost" } ] }, "added_to_eq_ref_extension": true, "condition_filtering_pct": 100, "rows_for_plan": 1, "cost_for_plan": 2.4, "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#": 1, "steps": [ { "join_explain": { "select#": 2, "steps": [ ] } } ] } } ] }