Skip to content

Instantly share code, notes, and snippets.

@seanlook
Last active November 11, 2017 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanlook/64990b956bf986eaeece5b26055f2f18 to your computer and use it in GitHub Desktop.
Save seanlook/64990b956bf986eaeece5b26055f2f18 to your computer and use it in GitHub Desktop.
{
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select `t_tbl_test_time_08`.`f_some_id` AS `f_some_id` from `t_tbl_test_time_08` where ((`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53')) order by `t_tbl_test_time_08`.`f_some_id` limit 8168"
}
]
}
},
{
"join_optimization": {
"select#": 1,
"steps": [
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "((`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53'))",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "((`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53') and multiple equal(5077665, `t_tbl_test_time_08`.`f_qiye_id`) and multiple equal(9, `t_tbl_test_time_08`.`f_type`))"
},
{
"transformation": "constant_propagation",
"resulting_condition": "((`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53') and multiple equal(5077665, `t_tbl_test_time_08`.`f_qiye_id`) and multiple equal(9, `t_tbl_test_time_08`.`f_type`))"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "((`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53') and multiple equal(5077665, `t_tbl_test_time_08`.`f_qiye_id`) and multiple equal(9, `t_tbl_test_time_08`.`f_type`))"
}
]
}
},
{
"table_dependencies": [
{
"table": "`t_tbl_test_time_08`",
"row_may_be_null": false,
"map_bit": 0,
"depends_on_map_bits": [
]
}
]
},
{
"ref_optimizer_key_uses": [
]
},
{
"rows_estimation": [
{
"table": "`t_tbl_test_time_08`",
"range_analysis": {
"table_scan": {
"rows": 18278388,
"cost": 3.71e6
},
"potential_range_indices": [
{
"index": "some_qiye_type",
"usable": false,
"cause": "not_applicable"
},
{
"index": "f_contact_time",
"usable": true,
"key_parts": [
"f_contact_time"
]
}
],
"setup_range_conditions": [
],
"group_index_range": {
"chosen": false,
"cause": "not_group_by_or_distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "f_contact_time",
"ranges": [
"2017-10-17 14:23:49 < f_contact_time < 2017-10-17 14:23:53"
],
"index_dives_for_eq_ranges": true,
"rowid_ordered": false,
"using_mrr": true,
"index_only": false,
"rows": 360478,
"cost": 414128,
"chosen": true
}
],
"analyzing_roworder_intersect": {
"usable": false,
"cause": "too_few_roworder_scans"
}
},
"chosen_range_access_summary": {
"range_access_plan": {
"type": "range_scan",
"index": "f_contact_time",
"rows": 360478,
"ranges": [
"2017-10-17 14:23:49 < f_contact_time < 2017-10-17 14:23:53"
]
},
"rows_for_plan": 360478,
"cost_for_plan": 414128,
"chosen": true
}
}
}
]
},
{
"considered_execution_plans": [
{
"plan_prefix": [
],
"table": "`t_tbl_test_time_08`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "range",
"rows": 360478,
"cost": 486224,
"chosen": true
}
]
},
"cost_for_plan": 486224,
"rows_for_plan": 360478,
"chosen": true
}
]
},
{
"attaching_conditions_to_tables": {
"original_condition": "((`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53'))",
"attached_conditions_computation": [
{
"table": "`t_tbl_test_time_08`",
"rechecking_index_usage": {
"recheck_reason": "low_limit",
"limit": 8168,
"row_estimate": 360478
}
}
],
"attached_conditions_summary": [
{
"table": "`t_tbl_test_time_08`",
"attached": "((`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53'))"
}
]
}
},
{
"clause_processing": {
"clause": "ORDER BY",
"original_clause": "`t_tbl_test_time_08`.`f_some_id`",
"items": [
{
"item": "`t_tbl_test_time_08`.`f_some_id`"
}
],
"resulting_clause_is_simple": true,
"resulting_clause": "`t_tbl_test_time_08`.`f_some_id`"
}
},
{
"refine_plan": [
{
"table": "`t_tbl_test_time_08`",
"pushed_index_condition": "((`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53'))",
"table_condition_attached": "((`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_qiye_id` = 5077665))",
"access_type": "range"
}
]
},
{
"reconsidering_access_paths_for_index_ordering": {
"clause": "ORDER BY",
"index_order_summary": {
"table": "`t_tbl_test_time_08`",
"index_provides_order": false,
"order_direction": "undefined",
"index": "f_contact_time",
"plan_changed": false
}
}
}
]
}
},
{
"join_execution": {
"select#": 1,
"steps": [
{
"filesort_information": [
{
"direction": "asc",
"table": "`t_tbl_test_time_08`",
"field": "f_some_id"
}
],
"filesort_priority_queue_optimization": {
"limit": 8168,
"rows_estimate": 43265832,
"row_size": 19,
"memory_available": 720896,
"chosen": true
},
"filesort_execution": [
],
"filesort_summary": {
"rows": 8169,
"examined_rows": 188155,
"number_of_tmp_files": 0,
"sort_buffer_size": 220563,
"sort_mode": "<sort_key, additional_fields>"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment