Last active
October 23, 2021 02:09
-
-
Save greenlion/979e0b45d121c504a31a1ce35f67a85e to your computer and use it in GitHub Desktop.
For MySQL bug 105308
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"steps": [ | |
{ | |
"join_preparation": { | |
"select#": 1, | |
"steps": [ | |
{ | |
"expanded_query": "/* select#1 */ select count(0) AS `count(*)` from ((((`lineorder` join `dim_date` on((`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`))) join `customer` on((`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`))) join `supplier` on((`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`))) join `part` on((`lineorder`.`LO_PartKey` = `part`.`P_PartKey`))) where ((`customer`.`C_Region` = 'AMERICA') and (`supplier`.`S_Region` = 'AMERICA') and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')))" | |
}, | |
{ | |
"transformations_to_nested_joins": { | |
"transformations": [ | |
"JOIN_condition_to_WHERE", | |
"parenthesis_removal" | |
], | |
"expanded_query": "/* select#1 */ select count(0) AS `count(*)` from `lineorder` join `dim_date` join `customer` join `supplier` join `part` where ((`customer`.`C_Region` = 'AMERICA') and (`supplier`.`S_Region` = 'AMERICA') and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')) and (`lineorder`.`LO_PartKey` = `part`.`P_PartKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`))" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"join_optimization": { | |
"select#": 1, | |
"steps": [ | |
{ | |
"condition_processing": { | |
"condition": "WHERE", | |
"original_condition": "((`customer`.`C_Region` = 'AMERICA') and (`supplier`.`S_Region` = 'AMERICA') and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')) and (`lineorder`.`LO_PartKey` = `part`.`P_PartKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`))", | |
"steps": [ | |
{ | |
"transformation": "equality_propagation", | |
"resulting_condition": "((multiple equal('MFGR#1', `part`.`P_MFGR`) or multiple equal('MFGR#2', `part`.`P_MFGR`)) and multiple equal('AMERICA', `customer`.`C_Region`) and multiple equal('AMERICA', `supplier`.`S_Region`) and multiple equal(`lineorder`.`LO_PartKey`, `part`.`P_PartKey`) and multiple equal(`lineorder`.`LO_SuppKey`, `supplier`.`S_SuppKey`) and multiple equal(`lineorder`.`LO_CustKey`, `customer`.`C_CustomerKey`) and multiple equal(`lineorder`.`LO_OrderDateKey`, `dim_date`.`D_DateKey`))" | |
}, | |
{ | |
"transformation": "constant_propagation", | |
"resulting_condition": "((multiple equal('MFGR#1', `part`.`P_MFGR`) or multiple equal('MFGR#2', `part`.`P_MFGR`)) and multiple equal('AMERICA', `customer`.`C_Region`) and multiple equal('AMERICA', `supplier`.`S_Region`) and multiple equal(`lineorder`.`LO_PartKey`, `part`.`P_PartKey`) and multiple equal(`lineorder`.`LO_SuppKey`, `supplier`.`S_SuppKey`) and multiple equal(`lineorder`.`LO_CustKey`, `customer`.`C_CustomerKey`) and multiple equal(`lineorder`.`LO_OrderDateKey`, `dim_date`.`D_DateKey`))" | |
}, | |
{ | |
"transformation": "trivial_condition_removal", | |
"resulting_condition": "((multiple equal('MFGR#1', `part`.`P_MFGR`) or multiple equal('MFGR#2', `part`.`P_MFGR`)) and multiple equal('AMERICA', `customer`.`C_Region`) and multiple equal('AMERICA', `supplier`.`S_Region`) and multiple equal(`lineorder`.`LO_PartKey`, `part`.`P_PartKey`) and multiple equal(`lineorder`.`LO_SuppKey`, `supplier`.`S_SuppKey`) and multiple equal(`lineorder`.`LO_CustKey`, `customer`.`C_CustomerKey`) and multiple equal(`lineorder`.`LO_OrderDateKey`, `dim_date`.`D_DateKey`))" | |
} | |
] | |
} | |
}, | |
{ | |
"substitute_generated_columns": { | |
} | |
}, | |
{ | |
"table_dependencies": [ | |
{ | |
"table": "`lineorder`", | |
"row_may_be_null": false, | |
"map_bit": 0, | |
"depends_on_map_bits": [ | |
] | |
}, | |
{ | |
"table": "`dim_date`", | |
"row_may_be_null": false, | |
"map_bit": 1, | |
"depends_on_map_bits": [ | |
] | |
}, | |
{ | |
"table": "`customer`", | |
"row_may_be_null": false, | |
"map_bit": 2, | |
"depends_on_map_bits": [ | |
] | |
}, | |
{ | |
"table": "`supplier`", | |
"row_may_be_null": false, | |
"map_bit": 3, | |
"depends_on_map_bits": [ | |
] | |
}, | |
{ | |
"table": "`part`", | |
"row_may_be_null": false, | |
"map_bit": 4, | |
"depends_on_map_bits": [ | |
] | |
} | |
] | |
}, | |
{ | |
"ref_optimizer_key_uses": [ | |
] | |
}, | |
{ | |
"rows_estimation": [ | |
{ | |
"table": "`lineorder`", | |
"table_scan": { | |
"rows": 5819986, | |
"cost": 12327.9 | |
} | |
}, | |
{ | |
"table": "`dim_date`", | |
"table_scan": { | |
"rows": 2556, | |
"cost": 5 | |
} | |
}, | |
{ | |
"table": "`customer`", | |
"table_scan": { | |
"rows": 29917, | |
"cost": 72.25 | |
} | |
}, | |
{ | |
"table": "`supplier`", | |
"table_scan": { | |
"rows": 2000, | |
"cost": 4.75 | |
} | |
}, | |
{ | |
"table": "`part`", | |
"table_scan": { | |
"rows": 198563, | |
"cost": 377 | |
} | |
} | |
] | |
}, | |
{ | |
"considered_execution_plans": [ | |
{ | |
"plan_prefix": [ | |
], | |
"table": "`supplier`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 2000, | |
"filtering_effect": [ | |
{ | |
"condition": "(`supplier`.`S_Region` = 'AMERICA')", | |
"histogram_selectivity": 0.189 | |
} | |
], | |
"final_filtering_effect": 0.189, | |
"access_type": "scan", | |
"resulting_rows": 378, | |
"cost": 204.75, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 378, | |
"cost_for_plan": 204.75, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": [ | |
"`supplier`" | |
], | |
"table": "`dim_date`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 2556, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 2556, | |
"cost": 96621.8, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 966168, | |
"cost_for_plan": 96826.5, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`" | |
], | |
"table": "`customer`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 29917, | |
"filtering_effect": [ | |
{ | |
"condition": "(`customer`.`C_Region` = 'AMERICA')", | |
"histogram_selectivity": 0.199733 | |
} | |
], | |
"final_filtering_effect": 0.199733, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 5975.42, | |
"cost": 5.77329e+08, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 5.77326e+09, | |
"cost_for_plan": 5.77426e+08, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`", | |
"`customer`" | |
], | |
"table": "`part`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 198563, | |
"filtering_effect": [ | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#1')", | |
"histogram_selectivity": 0.200112 | |
}, | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#2')", | |
"histogram_selectivity": 0.198179 | |
} | |
], | |
"final_filtering_effect": 0.358633, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1226, | |
"resulting_rows": 71211.3, | |
"cost": 4.11122e+13, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 4.11121e+14, | |
"cost_for_plan": 4.11127e+13, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`", | |
"`customer`", | |
"`part`" | |
], | |
"table": "`lineorder`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 5819986, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 123289500, | |
"resulting_rows": 5.81999e+06, | |
"cost": 2.39272e+20, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 0.01, | |
"rows_for_plan": 2.39272e+17, | |
"cost_for_plan": 2.39272e+20, | |
"chosen": true | |
} | |
] | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`", | |
"`customer`" | |
], | |
"table": "`lineorder`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 5819986, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1226, | |
"resulting_rows": 5.81999e+06, | |
"cost": 3.36003e+15, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 0.1, | |
"rows_for_plan": 3.36003e+13, | |
"cost_for_plan": 3.36003e+15, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`", | |
"`customer`", | |
"`lineorder`" | |
], | |
"table": "`part`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 198563, | |
"filtering_effect": [ | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#1')", | |
"histogram_selectivity": 0.200112 | |
}, | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#2')", | |
"histogram_selectivity": 0.198179 | |
} | |
], | |
"final_filtering_effect": 0.358633, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 8136107, | |
"resulting_rows": 71211.3, | |
"cost": 2.39272e+17, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 10, | |
"rows_for_plan": 2.39272e+17, | |
"cost_for_plan": 2.42632e+17, | |
"chosen": true | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`" | |
], | |
"table": "`part`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 198563, | |
"filtering_effect": [ | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#1')", | |
"histogram_selectivity": 0.200112 | |
}, | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#2')", | |
"histogram_selectivity": 0.198179 | |
} | |
], | |
"final_filtering_effect": 0.358633, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 71211.3, | |
"cost": 6.88022e+09, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 6.88021e+10, | |
"cost_for_plan": 6.88032e+09, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`", | |
"`dim_date`" | |
], | |
"table": "`lineorder`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 5819986, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 5.81999e+06, | |
"cost": 5.62308e+11, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 1, | |
"rows_for_plan": 5.62308e+10, | |
"cost_for_plan": 5.62309e+11, | |
"pruned_by_heuristic": true | |
} | |
] | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`" | |
], | |
"table": "`customer`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 29917, | |
"filtering_effect": [ | |
{ | |
"condition": "(`customer`.`C_Region` = 'AMERICA')", | |
"histogram_selectivity": 0.199733 | |
} | |
], | |
"final_filtering_effect": 0.199733, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 5975.42, | |
"cost": 228337, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 2.25871e+06, | |
"cost_for_plan": 228542, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`" | |
], | |
"table": "`part`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 198563, | |
"filtering_effect": [ | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#1')", | |
"histogram_selectivity": 0.200112 | |
}, | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#2')", | |
"histogram_selectivity": 0.198179 | |
} | |
], | |
"final_filtering_effect": 0.358633, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 71211.3, | |
"cost": 2.7049e+06, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 2.69179e+07, | |
"cost_for_plan": 2.7051e+06, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
"`supplier`" | |
], | |
"table": "`lineorder`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 5819986, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"using_join_cache": true, | |
"buffers_needed": 1, | |
"resulting_rows": 5.81999e+06, | |
"cost": 2.20008e+08, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 10, | |
"rows_for_plan": 2.19995e+08, | |
"cost_for_plan": 2.20008e+08, | |
"pruned_by_heuristic": true | |
} | |
] | |
}, | |
{ | |
"plan_prefix": [ | |
], | |
"table": "`dim_date`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 2556, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"resulting_rows": 2556, | |
"cost": 260.6, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 2556, | |
"cost_for_plan": 260.6, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
], | |
"table": "`customer`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 29917, | |
"filtering_effect": [ | |
{ | |
"condition": "(`customer`.`C_Region` = 'AMERICA')", | |
"histogram_selectivity": 0.199733 | |
} | |
], | |
"final_filtering_effect": 0.199733, | |
"access_type": "scan", | |
"resulting_rows": 5975.42, | |
"cost": 3063.95, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 5975.42, | |
"cost_for_plan": 3063.95, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
], | |
"table": "`part`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 198563, | |
"filtering_effect": [ | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#1')", | |
"histogram_selectivity": 0.200112 | |
}, | |
{ | |
"condition": "(`part`.`P_MFGR` = 'MFGR#2')", | |
"histogram_selectivity": 0.198179 | |
} | |
], | |
"final_filtering_effect": 0.358633, | |
"access_type": "scan", | |
"resulting_rows": 71211.3, | |
"cost": 20233.3, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 71211.3, | |
"cost_for_plan": 20233.3, | |
"pruned_by_heuristic": true | |
}, | |
{ | |
"plan_prefix": [ | |
], | |
"table": "`lineorder`", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"rows_to_scan": 5819986, | |
"filtering_effect": [ | |
], | |
"final_filtering_effect": 1, | |
"access_type": "scan", | |
"resulting_rows": 5.81999e+06, | |
"cost": 594326, | |
"chosen": true | |
} | |
] | |
}, | |
"condition_filtering_pct": 100, | |
"rows_for_plan": 5.81999e+06, | |
"cost_for_plan": 594326, | |
"pruned_by_heuristic": true | |
} | |
] | |
}, | |
{ | |
"attaching_conditions_to_tables": { | |
"original_condition": "((`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`) and (`part`.`P_PartKey` = `lineorder`.`LO_PartKey`) and (`supplier`.`S_Region` = 'AMERICA') and (`customer`.`C_Region` = 'AMERICA') and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')))", | |
"attached_conditions_computation": [ | |
], | |
"attached_conditions_summary": [ | |
{ | |
"table": "`supplier`", | |
"attached": "(`supplier`.`S_Region` = 'AMERICA')" | |
}, | |
{ | |
"table": "`dim_date`", | |
"attached": null | |
}, | |
{ | |
"table": "`customer`", | |
"attached": "(`customer`.`C_Region` = 'AMERICA')" | |
}, | |
{ | |
"table": "`lineorder`", | |
"attached": "((`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`))" | |
}, | |
{ | |
"table": "`part`", | |
"attached": "((`part`.`P_PartKey` = `lineorder`.`LO_PartKey`) and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')))" | |
} | |
] | |
} | |
}, | |
{ | |
"optimizing_distinct_group_by_order_by": { | |
} | |
}, | |
{ | |
"finalizing_table_conditions": [ | |
{ | |
"table": "`supplier`", | |
"original_table_condition": "(`supplier`.`S_Region` = 'AMERICA')", | |
"final_table_condition ": "(`supplier`.`S_Region` = 'AMERICA')" | |
}, | |
{ | |
"table": "`customer`", | |
"original_table_condition": "(`customer`.`C_Region` = 'AMERICA')", | |
"final_table_condition ": "(`customer`.`C_Region` = 'AMERICA')" | |
}, | |
{ | |
"table": "`lineorder`", | |
"original_table_condition": "((`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`))", | |
"final_table_condition ": "((`lineorder`.`LO_OrderDateKey` = `dim_date`.`D_DateKey`) and (`lineorder`.`LO_CustKey` = `customer`.`C_CustomerKey`) and (`lineorder`.`LO_SuppKey` = `supplier`.`S_SuppKey`))" | |
}, | |
{ | |
"table": "`part`", | |
"original_table_condition": "((`part`.`P_PartKey` = `lineorder`.`LO_PartKey`) and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')))", | |
"final_table_condition ": "((`part`.`P_PartKey` = `lineorder`.`LO_PartKey`) and ((`part`.`P_MFGR` = 'MFGR#1') or (`part`.`P_MFGR` = 'MFGR#2')))" | |
} | |
] | |
}, | |
{ | |
"refine_plan": [ | |
{ | |
"table": "`supplier`" | |
}, | |
{ | |
"table": "`dim_date`" | |
}, | |
{ | |
"table": "`customer`" | |
}, | |
{ | |
"table": "`lineorder`" | |
}, | |
{ | |
"table": "`part`" | |
} | |
] | |
}, | |
{ | |
"considering_tmp_tables": [ | |
] | |
} | |
] | |
} | |
}, | |
{ | |
"join_explain": { | |
"select#": 1, | |
"steps": [ | |
] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment