{\ "steps": [\ {\ "join_preparation": {\ "select_id": 1,\ "steps": [\ {\ "expanded_query": "select count(0) AS `count(*)` from (t1 join t2 on(t1.a = t2.a and t1.b = t2.b and (t1.c = t2.c or t1.c is null and t2.c is null) and t1.d < t2.d))"\ }\ ]\ }\ },\ {\ "join_optimization": {\ "select_id": 1,\ "steps": [\ {\ "condition_processing": {\ "condition": "WHERE",\ "original_condition": "t1.a = t2.a and t1.b = t2.b and (t1.c = t2.c or t1.c is null and t2.c is null) and t1.d < t2.d",\ "steps": [\ {\ "transformation": "equality_propagation",\ "resulting_condition": "(multiple equal(t1.c, t2.c) or t1.c is null and t2.c is null) and t1.d < t2.d and multiple equal(t1.a, t2.a) and multiple equal(t1.b, t2.b)"\ },\ {\ "transformation": "constant_propagation",\ "resulting_condition": "(multiple equal(t1.c, t2.c) or t1.c is null and t2.c is null) and t1.d < t2.d and multiple equal(t1.a, t2.a) and multiple equal(t1.b, t2.b)"\ },\ {\ "transformation": "trivial_condition_removal",\ "resulting_condition": "(multiple equal(t1.c, t2.c) or t1.c is null and t2.c is null) and t1.d < t2.d and multiple equal(t1.a, t2.a) and multiple equal(t1.b, t2.b)"\ }\ ]\ }\ },\ {\ "ref_optimizer_key_uses": [\ {\ "table": "t1",\ "index": "t1_ix1",\ "field": "a",\ "equals": "t2.a",\ "null_rejecting": true\ },\ {\ "table": "t1",\ "index": "t1_ix1",\ "field": "b",\ "equals": "t2.b",\ "null_rejecting": true\ },\ {\ "table": "t1",\ "index": "t1_ix1",\ "field": "c",\ "equals": "t2.c",\ "null_rejecting": false\ },\ {\ "table": "t2",\ "index": "t2_ix1",\ "field": "a",\ "equals": "t1.a",\ "null_rejecting": true\ },\ {\ "table": "t2",\ "index": "t2_ix1",\ "field": "b",\ "equals": "t1.b",\ "null_rejecting": true\ }\ ]\ },\ {\ "rows_estimation": [\ {\ "selectivity_for_indexes": [],\ "selectivity_for_columns": [],\ "cond_selectivity": 1\ },\ {\ "table": "t1",\ "table_scan": {\ "rows": 1010000,\ "read_cost": 134.7040372,\ "read_and_compare_cost": 167.0240372\ }\ },\ {\ "selectivity_for_indexes": [],\ "selectivity_for_columns": [],\ "cond_selectivity": 1\ },\ {\ "table": "t2",\ "table_scan": {\ "rows": 1000001,\ "read_cost": 133.3941682,\ "read_and_compare_cost": 165.3942002\ }\ }\ ]\ },\ {\ "table_dependencies": [\ {\ "table": "t1",\ "row_may_be_null": false,\ "map_bit": 0,\ "depends_on_map_bits": []\ },\ {\ "table": "t2",\ "row_may_be_null": false,\ "map_bit": 1,\ "depends_on_map_bits": []\ }\ ]\ },\ {\ "considered_execution_plans": [\ {\ "plan_prefix": "",\ "get_costs_for_tables": [\ {\ "best_access_path": {\ "table": "t2",\ "plan_details": {\ "record_count": 1\ },\ "considered_access_paths": [\ {\ "access_type": "scan",\ "rows": 1000001,\ "rows_after_filter": 1000001,\ "rows_out": 1000001,\ "cost": 165.3942002,\ "index_only": false,\ "chosen": true\ }\ ],\ "chosen_access_method": {\ "type": "scan",\ "rows_read": 1000001,\ "rows_out": 1000001,\ "cost": 165.3942002,\ "uses_join_buffering": false\ }\ }\ },\ {\ "best_access_path": {\ "table": "t1",\ "plan_details": {\ "record_count": 1\ },\ "considered_access_paths": [\ {\ "access_type": "scan",\ "rows": 1010000,\ "rows_after_filter": 1010000,\ "rows_out": 1010000,\ "cost": 167.0240372,\ "index_only": false,\ "chosen": true\ }\ ],\ "chosen_access_method": {\ "type": "scan",\ "rows_read": 1010000,\ "rows_out": 1010000,\ "cost": 167.0240372,\ "uses_join_buffering": false\ }\ }\ }\ ]\ },\ {\ "plan_prefix": "",\ "table": "t2",\ "rows_for_plan": 1000001,\ "cost_for_plan": 165.3942002,\ "rest_of_plan": [\ {\ "plan_prefix": "t2",\ "get_costs_for_tables": [\ {\ "best_access_path": {\ "table": "t1",\ "plan_details": {\ "record_count": 1000001\ },\ "considered_access_paths": [\ {\ "access_type": "ref_or_null",\ "index": "t1_ix1",\ "rows": 2.02,\ "cost": 3609.059836,\ "chosen": true\ },\ {\ "access_type": "scan_with_join_cache",\ "rows": 1010000,\ "rows_after_filter": 1010000,\ "rows_out": 2.02,\ "cost": 93805525,\ "cost_without_join_buffer": 164739455.4,\ "index_only": false,\ "chosen": false\ }\ ],\ "chosen_access_method": {\ "type": "ref_or_null",\ "rows_read": 2.02,\ "rows_out": 2.02,\ "cost": 3609.059836,\ "uses_join_buffering": false\ }\ }\ }\ ]\ },\ {\ "plan_prefix": "t2",\ "table": "t1",\ "rows_for_plan": 2020002.02,\ "cost_for_plan": 3774.454036\ }\ ]\ },\ {\ "plan_prefix": "",\ "table": "t1",\ "rows_for_plan": 1010000,\ "cost_for_plan": 167.0240372,\ "rest_of_plan": [\ {\ "plan_prefix": "t1",\ "get_costs_for_tables": [\ {\ "best_access_path": {\ "table": "t2",\ "plan_details": {\ "record_count": 1010000\ },\ "considered_access_paths": [\ {\ "access_type": "ref",\ "index": "t2_ix1",\ "used_range_estimates": false,\ "reason": "not available",\ "rows": 100.0001,\ "cost": 101175.7793,\ "chosen": true\ },\ {\ "access_type": "scan_with_join_cache",\ "rows": 1000001,\ "rows_after_filter": 1000001,\ "rows_out": 100.0001,\ "cost": 93805582.78,\ "cost_without_join_buffer": 164740548.2,\ "index_only": false,\ "chosen": false\ }\ ],\ "chosen_access_method": {\ "type": "ref",\ "index": "t2_ix1",\ "rows_read": 100.0001,\ "rows_out": 100.0001,\ "cost": 101175.7793,\ "uses_join_buffering": false\ }\ }\ }\ ]\ },\ {\ "plan_prefix": "t1",\ "table": "t2",\ "rows_for_plan": 101000101,\ "cost_for_plan": 101342.8034,\ "pruned_by_cost": true,\ "current_cost": 101342.8034,\ "best_cost": 3774.454036\ }\ ]\ }\ ]\ },\ {\ "best_join_order": ["t2", "t1"],\ "rows": 2020002.02,\ "cost": 3774.454036\ },\ {\ "substitute_best_equal": {\ "condition": "WHERE",\ "resulting_condition": "t1.a = t2.a and t1.b = t2.b and (t1.c = t2.c or t1.c is null and t2.c is null) and t1.d < t2.d"\ }\ },\ {\ "attaching_conditions_to_tables": {\ "attached_conditions_computation": [],\ "attached_conditions_summary": [\ {\ "table": "t2",\ "attached_condition": "t2.a is not null and t2.b is not null"\ },\ {\ "table": "t1",\ "attached_condition": "(t1.c = t2.c or t1.c is null and t2.c is null) and t1.d < t2.d"\ }\ ]\ }\ },\ {\ "make_join_readinfo": [\ {\ "table": "t1",\ "index_condition": "t1.c = t2.c or t1.c is null and t2.c is null",\ "row_condition": "t1.d < t2.d"\ }\ ]\ },\ {\ "prepare_sum_aggregators": {\ "function": "count(0)",\ "aggregator_type": "simple"\ }\ }\ ]\ }\ },\ {\ "join_execution": {\ "select_id": 1,\ "steps": []\ }\ }\ ]\ }