{ "steps": [ { "join_preparation": { "select_id": 1, "steps": [ { "join_preparation": { "select_id": 2, "steps": [ { "expanded_query": "/* select#2 */ select count(0) from t1 where year(t1.a) = 2010" } ] } }, { "expanded_query": "/* select#1 */ update t1 set t1.c = 0 where year(t1.a) = 2010 and t1.c < (/* select#2 */ select count(0) from t1 where year(t1.a) = 2010)" } ] } }, { "join_optimization": { "select_id": 1, "steps": [ { "join_optimization": { "select_id": 2, "steps": [ { "transformation": "date_conds_into_sargable", "before": "year(t1.a) = 2010", "after": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')" }, { "condition_processing": { "condition": "WHERE", "original_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')" }, { "transformation": "constant_propagation", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')" }, { "transformation": "trivial_condition_removal", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')" } ] } }, { "ref_optimizer_key_uses": [] }, { "rows_estimation": [ { "table": "t1", "range_analysis": { "table_scan": { "rows": 7, "cost": 0.0119958 }, "potential_range_indexes": [ { "index": "PRIMARY", "usable": false, "cause": "not applicable" }, { "index": "a", "usable": true, "key_parts": ["a", "pk"] } ], "best_covering_index_scan": { "index": "a", "cost": 0.007672715, "chosen": true }, "setup_range_conditions": [], "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "a", "ranges": [ "(2010-01-01 00:00:00) <= (a) <= (2010-12-31 23:59:59)" ], "rowid_ordered": false, "using_mrr": false, "index_only": true, "rows": 2, "cost": 0.00273041, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" } }, "group_index_range": { "chosen": false, "cause": "no group by or distinct" }, "chosen_range_access_summary": { "range_access_plan": { "type": "range_scan", "index": "a", "rows": 2, "ranges": [ "(2010-01-01 00:00:00) <= (a) <= (2010-12-31 23:59:59)" ] }, "rows_for_plan": 2, "cost_for_plan": 0.00273041, "chosen": true } } }, { "table": "t1", "rowid_filters": [ { "key": "a", "build_cost": 0.001885902, "rows": 2 } ] }, { "selectivity_for_indexes": [ { "index_name": "a", "selectivity_from_index": 0.285714286 } ], "selectivity_for_columns": [], "cond_selectivity": 0.285714286 } ] }, { "table_dependencies": [ { "table": "t1", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [] } ] }, { "considered_execution_plans": [ { "plan_prefix": "", "get_costs_for_tables": [ { "best_access_path": { "table": "t1", "plan_details": { "record_count": 1 }, "considered_access_paths": [ { "access_type": "range", "range_index": "a", "rows": 2, "rows_after_filter": 2, "rows_out": 2, "cost": 0.00273041, "chosen": true } ], "chosen_access_method": { "type": "range", "index": "a", "rows_read": 2, "rows_out": 2, "cost": 0.00273041, "uses_join_buffering": false } } } ] }, { "plan_prefix": "", "table": "t1", "rows_for_plan": 2, "cost_for_plan": 0.00273041 } ] }, { "best_join_order": ["t1"], "rows": 2, "cost": 0.00273041 }, { "substitute_best_equal": { "condition": "WHERE", "resulting_condition": "t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59'" } }, { "attaching_conditions_to_tables": { "attached_conditions_computation": [], "attached_conditions_summary": [ { "table": "t1", "attached_condition": "t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59'" } ] } }, { "make_join_readinfo": [] }, { "prepare_sum_aggregators": { "function": "count(0)", "aggregator_type": "simple" } } ] } }, { "transformation": "date_conds_into_sargable", "before": "year(t1.a) = 2010", "after": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59')" }, { "condition_processing": { "condition": "WHERE", "original_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59') and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59') and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" }, { "transformation": "constant_propagation", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59') and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" }, { "transformation": "trivial_condition_removal", "resulting_condition": "t1.a between ('2010-01-01 00:00:00') and ('2010-12-31 23:59:59') and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" } ] } }, { "ref_optimizer_key_uses": [] }, { "rows_estimation": [ { "table": "t1", "range_analysis": { "table_scan": { "rows": 7, "cost": 0.0119958 }, "potential_range_indexes": [ { "index": "PRIMARY", "usable": false, "cause": "not applicable" }, { "index": "a", "usable": true, "key_parts": ["a", "pk"] } ], "setup_range_conditions": [], "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "a", "ranges": [ "(2010-01-01 00:00:00) <= (a) <= (2010-12-31 23:59:59)" ], "rowid_ordered": false, "using_mrr": false, "index_only": false, "rows": 2, "cost": 0.00273041, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" } }, "group_index_range": { "chosen": false, "cause": "no group by or distinct" }, "chosen_range_access_summary": { "range_access_plan": { "type": "range_scan", "index": "a", "rows": 2, "ranges": [ "(2010-01-01 00:00:00) <= (a) <= (2010-12-31 23:59:59)" ] }, "rows_for_plan": 2, "cost_for_plan": 0.00273041, "chosen": true } } }, { "table": "t1", "rowid_filters": [ { "key": "a", "build_cost": 0.001885902, "rows": 2 } ] }, { "selectivity_for_indexes": [ { "index_name": "a", "selectivity_from_index": 0.285714286 } ], "selectivity_for_columns": [], "cond_selectivity": 0.285714286 } ] }, { "table_dependencies": [ { "table": "t1", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [] } ] }, { "considered_execution_plans": [ { "plan_prefix": "", "get_costs_for_tables": [ { "best_access_path": { "table": "t1", "plan_details": { "record_count": 1 }, "considered_access_paths": [ { "access_type": "range", "range_index": "a", "rows": 2, "rows_after_filter": 2, "rows_out": 2, "cost": 0.00273041, "chosen": true } ], "chosen_access_method": { "type": "range", "index": "a", "rows_read": 2, "rows_out": 2, "cost": 0.00273041, "uses_join_buffering": false } } } ] }, { "plan_prefix": "", "table": "t1", "rows_for_plan": 2, "cost_for_plan": 0.00273041 } ] }, { "best_join_order": ["t1"], "rows": 2, "cost": 0.00273041 }, { "substitute_best_equal": { "condition": "WHERE", "resulting_condition": "t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59' and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" } }, { "attaching_conditions_to_tables": { "attached_conditions_computation": [], "attached_conditions_summary": [ { "table": "t1", "attached_condition": "t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59' and t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" } ] } }, { "make_join_readinfo": [ { "table": "t1", "index_condition": "t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59'", "row_condition": "t1.c < (/* select#2 */ select count(0) from t1 where t1.a between '2010-01-01 00:00:00' and '2010-12-31 23:59:59')" } ] } ] } } ] }