Skip to content

Instantly share code, notes, and snippets.

@aping
Created November 27, 2018 09:24
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 aping/9b00cfa388831486805378279b7732ff to your computer and use it in GitHub Desktop.
Save aping/9b00cfa388831486805378279b7732ff to your computer and use it in GitHub Desktop.
optimizer trace
mysql> select * from information_schema.optimizer_trace \G
*************************** 1. row ***************************
QUERY: explain select u.*, p.nickname, p.avatar, p.background_image_path, p.self_introduction, p.renamed,
pw.salt, pw.password, pw.pay_password,
r.recommend_user_id,
v.name, v.id_number,
s.user_id as status_user_id, s.id_verify as status_id_verify, s.redo_id_verify as status_redo_id_verify,
s.has_password as status_has_password, s.has_pay_password as status_has_pay_password,
s.has_phone as status_has_phone, s.has_email as status_has_email,
s.create_time as status_create_time, s.update_time as status_update_time,
st.user_id as stat_user_id, st.follows as stat_follows, st.fans as stat_fans,
st.subscribes as stat_subscribes, st.articles as stat_articles,
st.create_time as stat_create_time, st.update_time as stat_update_time,
uv.user_id as uv_user_id, uv.verify_type as uv_verify_type, uv.verify_title as uv_verify_title,
uv.create_time as uv_create_time, uv.update_time as uv_update_time
from user u
inner join user_profile p on u.id = p.user_id
inner join user_status s on u.id = s.user_id
inner join user_stat st on u.id = st.user_id
left outer join user_recommend r on u.id = r.user_id
left outer join user_id_verify v on u.id = v.user_id
left outer join user_password pw on u.id = pw.user_id
left outer join user_verify uv on u.id = uv.user_id
where 1 = 1
order by u.id LIMIT 100
TRACE: {
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select `u`.`id` AS `id`,`u`.`member_id` AS `member_id`,`u`.`phone` AS `phone`,`u`.`email` AS `email`,`u`.`is_valid` AS `is_valid`,`u`.`create_time` AS `create_time`,`u`.`update_time` AS `update_time`,`p`.`nickname` AS `nickname`,`p`.`avatar` AS `avatar`,`p`.`background_image_path` AS `background_image_path`,`p`.`self_introduction` AS `self_introduction`,`p`.`renamed` AS `renamed`,`pw`.`salt` AS `salt`,`pw`.`password` AS `password`,`pw`.`pay_password` AS `pay_password`,`r`.`recommend_user_id` AS `recommend_user_id`,`v`.`name` AS `name`,`v`.`id_number` AS `id_number`,`s`.`user_id` AS `status_user_id`,`s`.`id_verify` AS `status_id_verify`,`s`.`redo_id_verify` AS `status_redo_id_verify`,`s`.`has_password` AS `status_has_password`,`s`.`has_pay_password` AS `status_has_pay_password`,`s`.`has_phone` AS `status_has_phone`,`s`.`has_email` AS `status_has_email`,`s`.`create_time` AS `status_create_time`,`s`.`update_time` AS `status_update_time`,`st`.`user_id` AS `stat_user_id`,`st`.`follows` AS `stat_follows`,`st`.`fans` AS `stat_fans`,`st`.`subscribes` AS `stat_subscribes`,`st`.`articles` AS `stat_articles`,`st`.`create_time` AS `stat_create_time`,`st`.`update_time` AS `stat_update_time`,`uv`.`user_id` AS `uv_user_id`,`uv`.`verify_type` AS `uv_verify_type`,`uv`.`verify_title` AS `uv_verify_title`,`uv`.`create_time` AS `uv_create_time`,`uv`.`update_time` AS `uv_update_time` from (((((((`user` `u` join `user_profile` `p` on((`u`.`id` = `p`.`user_id`))) join `user_status` `s` on((`u`.`id` = `s`.`user_id`))) join `user_stat` `st` on((`u`.`id` = `st`.`user_id`))) left join `user_recommend` `r` on((`u`.`id` = `r`.`user_id`))) left join `user_id_verify` `v` on((`u`.`id` = `v`.`user_id`))) left join `user_password` `pw` on((`u`.`id` = `pw`.`user_id`))) left join `user_verify` `uv` on((`u`.`id` = `uv`.`user_id`))) where (1 = 1) order by `u`.`id` limit 100"
}
]
}
},
{
"join_optimization": {
"select#": 1,
"steps": [
{
"transformations_to_nested_joins": {
"transformations": [
"JOIN_condition_to_WHERE",
"parenthesis_removal"
],
"expanded_query": "/* select#1 */ select `u`.`id` AS `id`,`u`.`member_id` AS `member_id`,`u`.`phone` AS `phone`,`u`.`email` AS `email`,`u`.`is_valid` AS `is_valid`,`u`.`create_time` AS `create_time`,`u`.`update_time` AS `update_time`,`p`.`nickname` AS `nickname`,`p`.`avatar` AS `avatar`,`p`.`background_image_path` AS `background_image_path`,`p`.`self_introduction` AS `self_introduction`,`p`.`renamed` AS `renamed`,`pw`.`salt` AS `salt`,`pw`.`password` AS `password`,`pw`.`pay_password` AS `pay_password`,`r`.`recommend_user_id` AS `recommend_user_id`,`v`.`name` AS `name`,`v`.`id_number` AS `id_number`,`s`.`user_id` AS `status_user_id`,`s`.`id_verify` AS `status_id_verify`,`s`.`redo_id_verify` AS `status_redo_id_verify`,`s`.`has_password` AS `status_has_password`,`s`.`has_pay_password` AS `status_has_pay_password`,`s`.`has_phone` AS `status_has_phone`,`s`.`has_email` AS `status_has_email`,`s`.`create_time` AS `status_create_time`,`s`.`update_time` AS `status_update_time`,`st`.`user_id` AS `stat_user_id`,`st`.`follows` AS `stat_follows`,`st`.`fans` AS `stat_fans`,`st`.`subscribes` AS `stat_subscribes`,`st`.`articles` AS `stat_articles`,`st`.`create_time` AS `stat_create_time`,`st`.`update_time` AS `stat_update_time`,`uv`.`user_id` AS `uv_user_id`,`uv`.`verify_type` AS `uv_verify_type`,`uv`.`verify_title` AS `uv_verify_title`,`uv`.`create_time` AS `uv_create_time`,`uv`.`update_time` AS `uv_update_time` from `user` `u` join `user_profile` `p` join `user_status` `s` join `user_stat` `st` left join `user_recommend` `r` on((`u`.`id` = `r`.`user_id`)) left join `user_id_verify` `v` on((`u`.`id` = `v`.`user_id`)) left join `user_password` `pw` on((`u`.`id` = `pw`.`user_id`)) left join `user_verify` `uv` on((`u`.`id` = `uv`.`user_id`)) where ((1 = 1) and (`u`.`id` = `st`.`user_id`) and (`u`.`id` = `s`.`user_id`) and (`u`.`id` = `p`.`user_id`)) order by `u`.`id` limit 100"
}
},
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "((1 = 1) and (`u`.`id` = `st`.`user_id`) and (`u`.`id` = `s`.`user_id`) and (`u`.`id` = `p`.`user_id`))",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "((1 = 1) and multiple equal(`u`.`id`, `st`.`user_id`, `s`.`user_id`, `p`.`user_id`))"
},
{
"transformation": "constant_propagation",
"resulting_condition": "((1 = 1) and multiple equal(`u`.`id`, `st`.`user_id`, `s`.`user_id`, `p`.`user_id`))"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "multiple equal(`u`.`id`, `st`.`user_id`, `s`.`user_id`, `p`.`user_id`)"
}
]
}
},
{
"table_dependencies": [
{
"table": "`user` `u`",
"row_may_be_null": false,
"map_bit": 0,
"depends_on_map_bits": [
]
},
{
"table": "`user_profile` `p`",
"row_may_be_null": false,
"map_bit": 1,
"depends_on_map_bits": [
]
},
{
"table": "`user_status` `s`",
"row_may_be_null": false,
"map_bit": 2,
"depends_on_map_bits": [
]
},
{
"table": "`user_stat` `st`",
"row_may_be_null": false,
"map_bit": 3,
"depends_on_map_bits": [
]
},
{
"table": "`user_recommend` `r`",
"row_may_be_null": true,
"map_bit": 4,
"depends_on_map_bits": [
0
]
},
{
"table": "`user_id_verify` `v`",
"row_may_be_null": true,
"map_bit": 5,
"depends_on_map_bits": [
0,
4
]
},
{
"table": "`user_password` `pw`",
"row_may_be_null": true,
"map_bit": 6,
"depends_on_map_bits": [
0,
4,
5
]
},
{
"table": "`user_verify` `uv`",
"row_may_be_null": true,
"map_bit": 7,
"depends_on_map_bits": [
0,
4,
5,
6
]
}
]
},
{
"ref_optimizer_key_uses": [
{
"table": "`user` `u`",
"field": "id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user` `u`",
"field": "id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user` `u`",
"field": "id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_profile` `p`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_profile` `p`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_profile` `p`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_status` `s`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_status` `s`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_status` `s`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_stat` `st`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_stat` `st`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_stat` `st`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_recommend` `r`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_recommend` `r`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_recommend` `r`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_recommend` `r`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_id_verify` `v`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_id_verify` `v`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_id_verify` `v`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_id_verify` `v`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_password` `pw`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_password` `pw`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_password` `pw`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_password` `pw`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_verify` `uv`",
"field": "user_id",
"equals": "`u`.`id`",
"null_rejecting": false
},
{
"table": "`user_verify` `uv`",
"field": "user_id",
"equals": "`st`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_verify` `uv`",
"field": "user_id",
"equals": "`s`.`user_id`",
"null_rejecting": false
},
{
"table": "`user_verify` `uv`",
"field": "user_id",
"equals": "`p`.`user_id`",
"null_rejecting": false
}
]
},
{
"rows_estimation": [
{
"table": "`user` `u`",
"table_scan": {
"rows": 363668,
"cost": 1123
}
},
{
"table": "`user_profile` `p`",
"table_scan": {
"rows": 368240,
"cost": 2405
}
},
{
"table": "`user_status` `s`",
"table_scan": {
"rows": 364741,
"cost": 1315
}
},
{
"table": "`user_stat` `st`",
"table_scan": {
"rows": 364800,
"cost": 1251
}
},
{
"table": "`user_recommend` `r`",
"table_scan": {
"rows": 257114,
"cost": 865
}
},
{
"table": "`user_id_verify` `v`",
"table_scan": {
"rows": 367637,
"cost": 1700
}
},
{
"table": "`user_password` `pw`",
"table_scan": {
"rows": 361286,
"cost": 3814
}
},
{
"table": "`user_verify` `uv`",
"table_scan": {
"rows": 4,
"cost": 1
}
}
]
},
{
"considered_execution_plans": [
{
"plan_prefix": [
],
"table": "`user` `u`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"usable": false,
"chosen": false
},
{
"access_type": "scan",
"rows": 363668,
"cost": 73857,
"chosen": true
}
]
},
"cost_for_plan": 73857,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`"
],
"table": "`user_status` `s`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273556,
"cost": 2e10,
"chosen": false
}
]
},
"cost_for_plan": 510258,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`"
],
"table": "`user_stat` `st`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273600,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 946660,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`"
],
"table": "`user_profile` `p`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 276180,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.38e6,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_profile` `p`"
],
"table": "`user_recommend` `r`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"cause": "covering_index_better_than_full_scan",
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.82e6,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`"
],
"table": "`user_id_verify` `v`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 275728,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.26e6,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`"
],
"table": "`user_password` `pw`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 270965,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.69e6,
"rows_for_plan": 363668,
"rest_of_plan": [
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223182,
"chosen": true
}
]
},
"added_to_eq_ref_extension": false
},
{
"plan_prefix": [
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 363668,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223182,
"chosen": true
}
]
},
"cost_for_plan": 2.92e6,
"rows_for_plan": 1.09e6,
"chosen": true
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"plan_prefix": [
],
"table": "`user_status` `s`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"usable": false,
"chosen": false
},
{
"access_type": "scan",
"rows": 364741,
"cost": 74263,
"chosen": true
}
]
},
"cost_for_plan": 74263,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`"
],
"table": "`user` `u`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 272751,
"cost": 2e10,
"chosen": false
}
]
},
"cost_for_plan": 511952,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`"
],
"table": "`user_stat` `st`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273600,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 949642,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`"
],
"table": "`user_profile` `p`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 276180,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.39e6,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`",
"`user_profile` `p`"
],
"table": "`user_recommend` `r`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"cause": "covering_index_better_than_full_scan",
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.83e6,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`"
],
"table": "`user_id_verify` `v`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 275728,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.26e6,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`"
],
"table": "`user_password` `pw`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 270965,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.7e6,
"rows_for_plan": 364741,
"rest_of_plan": [
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223841,
"chosen": true
}
]
},
"added_to_eq_ref_extension": false
},
{
"plan_prefix": [
"`user_status` `s`",
"`user` `u`",
"`user_stat` `st`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364741,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223841,
"chosen": true
}
]
},
"cost_for_plan": 2.92e6,
"rows_for_plan": 1.09e6,
"pruned_by_cost": true
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"plan_prefix": [
],
"table": "`user_stat` `st`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"usable": false,
"chosen": false
},
{
"access_type": "scan",
"rows": 364800,
"cost": 74211,
"chosen": true
}
]
},
"cost_for_plan": 74211,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`"
],
"table": "`user` `u`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 272751,
"cost": 2e10,
"chosen": false
}
]
},
"cost_for_plan": 511971,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`"
],
"table": "`user_status` `s`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273556,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 949731,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`"
],
"table": "`user_profile` `p`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 276180,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.39e6,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`",
"`user_profile` `p`"
],
"table": "`user_recommend` `r`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"cause": "covering_index_better_than_full_scan",
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.83e6,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`",
"`user_profile` `p`",
"`user_recommend` `r`"
],
"table": "`user_id_verify` `v`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 275728,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.26e6,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`"
],
"table": "`user_password` `pw`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 270965,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.7e6,
"rows_for_plan": 364800,
"rest_of_plan": [
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223877,
"chosen": true
}
]
},
"added_to_eq_ref_extension": false
},
{
"plan_prefix": [
"`user_stat` `st`",
"`user` `u`",
"`user_status` `s`",
"`user_profile` `p`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 364800,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 223877,
"chosen": true
}
]
},
"cost_for_plan": 2.92e6,
"rows_for_plan": 1.09e6,
"pruned_by_cost": true
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"plan_prefix": [
],
"table": "`user_profile` `p`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"usable": false,
"chosen": false
},
{
"access_type": "scan",
"rows": 368240,
"cost": 76053,
"chosen": true
}
]
},
"cost_for_plan": 76053,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`"
],
"table": "`user` `u`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 272751,
"cost": 2e10,
"chosen": false
}
]
},
"cost_for_plan": 517941,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`"
],
"table": "`user_status` `s`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273556,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 959829,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`"
],
"table": "`user_stat` `st`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 273600,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.4e6,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`"
],
"table": "`user_recommend` `r`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"cause": "covering_index_better_than_full_scan",
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 1.84e6,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_recommend` `r`"
],
"table": "`user_id_verify` `v`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 275728,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.29e6,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_recommend` `r`",
"`user_id_verify` `v`"
],
"table": "`user_password` `pw`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 270965,
"cost": 2e10,
"chosen": false
}
]
},
"added_to_eq_ref_extension": true,
"cost_for_plan": 2.73e6,
"rows_for_plan": 368240,
"rest_of_plan": [
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 225988,
"chosen": true
}
]
},
"added_to_eq_ref_extension": false
},
{
"plan_prefix": [
"`user_profile` `p`",
"`user` `u`",
"`user_status` `s`",
"`user_stat` `st`",
"`user_recommend` `r`",
"`user_id_verify` `v`",
"`user_password` `pw`"
],
"table": "`user_verify` `uv`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "PRIMARY",
"rows": 1,
"cost": 368240,
"chosen": true
},
{
"access_type": "scan",
"using_join_cache": true,
"rows": 3,
"cost": 225988,
"chosen": true
}
]
},
"cost_for_plan": 2.95e6,
"rows_for_plan": 1.1e6,
"pruned_by_cost": true
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"attaching_conditions_to_tables": {
"original_condition": "((`s`.`user_id` = `u`.`id`) and (`st`.`user_id` = `u`.`id`) and (`p`.`user_id` = `u`.`id`))",
"attached_conditions_computation": [
{
"table": "`user_verify` `uv`",
"rechecking_index_usage": {
"recheck_reason": "not_first_table",
"range_analysis": {
"table_scan": {
"rows": 4,
"cost": 3.9
},
"potential_range_indices": [
{
"index": "PRIMARY",
"usable": true,
"key_parts": [
"user_id"
]
}
],
"setup_range_conditions": [
],
"group_index_range": {
"chosen": false,
"cause": "not_single_table"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "PRIMARY",
"chosen": false,
"cause": "unknown"
}
],
"analyzing_roworder_intersect": {
"usable": false,
"cause": "too_few_roworder_scans"
}
}
}
}
}
],
"attached_conditions_summary": [
{
"table": "`user` `u`",
"attached": null
},
{
"table": "`user_status` `s`",
"attached": null
},
{
"table": "`user_stat` `st`",
"attached": null
},
{
"table": "`user_profile` `p`",
"attached": null
},
{
"table": "`user_recommend` `r`",
"attached": null
},
{
"table": "`user_id_verify` `v`",
"attached": null
},
{
"table": "`user_password` `pw`",
"attached": null
},
{
"table": "`user_verify` `uv`",
"attached": "<if>(is_not_null_compl(uv), (`uv`.`user_id` = `u`.`id`), true)"
}
]
}
},
{
"clause_processing": {
"clause": "ORDER BY",
"original_clause": "`u`.`id`",
"items": [
{
"item": "`u`.`id`"
}
],
"resulting_clause_is_simple": true,
"resulting_clause": "`u`.`id`"
}
},
{
"refine_plan": [
{
"table": "`user` `u`",
"access_type": "table_scan"
},
{
"table": "`user_status` `s`"
},
{
"table": "`user_stat` `st`"
},
{
"table": "`user_profile` `p`"
},
{
"table": "`user_recommend` `r`"
},
{
"table": "`user_id_verify` `v`"
},
{
"table": "`user_password` `pw`"
},
{
"table": "`user_verify` `uv`",
"access_type": "table_scan"
}
]
}
]
}
},
{
"join_explain": {
"select#": 1,
"steps": [
]
}
}
]
}
MISSING_BYTES_BEYOND_MAX_MEM_SIZE: 0
INSUFFICIENT_PRIVILEGES: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment