|
... which is not a problem as such.
We get the problem when we do Item tree walking. Execution spends a lot of time walking the item tree:
#0 0x0000555556273e3c in bitmap_set_bit (map=0x7fffa0033e68, bit=4) at /home/psergey/dev-git2/10.6/include/my_bitmap.h:98
|
#1 0x0000555556276bd3 in Item_field::register_field_in_read_map (this=0x7fffa09a9db8, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.cc:893
|
#2 0x0000555555d7e2e0 in Item::walk (this=0x7fffa09a9db8, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2118
|
#3 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09aa500, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#4 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09aa490, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#5 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0992ba0, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#6 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a7f38, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#7 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a7ec8, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#8 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a8df0, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#9 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a8d80, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#10 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0995000, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#11 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a76e0, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#12 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a7670, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#13 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0997330, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#14 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a3978, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#15 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a3908, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#16 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa001ddf8, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#17 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a1968, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#18 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a18f8, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#19 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a2268, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#20 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a21f8, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#21 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0020c38, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#22 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa09a0b58, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#23 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa09a0ae8, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#24 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0022ec0, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#25 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa001ae08, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#26 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa001ad98, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#27 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa001bcc0, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#28 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa001bc50, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#29 0x000055555629a898 in Item_direct_view_ref::walk (this=0x7fffa0024408, processor=&virtual Item::register_field_in_read_map(void*), walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:6083
|
#30 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa0019cb0, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#31 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa0019c40, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#32 0x0000555555e1514b in Item_args::walk_args (this=0x7fffa001a5b0, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:2773
|
#33 0x0000555555e1571a in Item_func_or_sum::walk (this=0x7fffa001a540, processor=&virtual table offset 944, walk_subquery=false, arg=0x0) at /home/psergey/dev-git2/10.6/sql/item.h:5476
|
#34 0x0000555555e0b5ac in find_field_in_table_ref (thd=0x7fffa0000d78, table_list=0x7fffa098ffe0, name=0x7fffa0018410 "s8", length=2, item_name=0x7fffa0018410 "s8", db_name=0x0, table_name=0x0, ignored_tables=0x0, ref=0x7fffa00185b0, check_privileges=true, allow_rowid=true, cached_field_index_ptr=0x7fffa0018500, register_tree_change=true, actual_table=0x7fffec955b50) at /home/psergey/dev-git2/10.6/sql/sql_base.cc:6264
|
#35 0x0000555555e0bf2a in find_field_in_tables (thd=0x7fffa0000d78, item=0x7fffa0018418, first_table=0x7fffa098ffe0, last_table=0x0, ignored_tables=0x0, ref=0x7fffa00185b0, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at /home/psergey/dev- git2/10.6/sql/sql_base.cc:6520
|
#36 0x00005555562879c6 in Item_field::fix_fields (this=0x7fffa0018418, thd=0x7fffa0000d78, reference=0x7fffa00185b0) at /home/psergey/dev-git2/10.6/sql/item.cc:6007
|
#37 0x0000555555d8ad26 in Item::fix_fields_if_needed (this=0x7fffa0018418, thd=0x7fffa0000d78, ref=0x7fffa00185b0) at /home/psergey/dev-git2/10.6/sql/item.h:1147
|
#38 0x00005555562df811 in Item_func::fix_fields (this=0x7fffa0018530, thd=0x7fffa0000d78, ref=0x7fffa0018f48) at /home/psergey/dev-git2/10.6/sql/item_func.cc:350
|
#39 0x0000555555d8ad26 in Item::fix_fields_if_needed (this=0x7fffa0018530, thd=0x7fffa0000d78, ref=0x7fffa0018f48) at /home/psergey/dev-git2/10.6/sql/item.h:1147
|
#40 0x00005555562df811 in Item_func::fix_fields (this=0x7fffa0018e30, thd=0x7fffa0000d78, ref=0x7fffa0018f80) at /home/psergey/dev-git2/10.6/sql/item_func.cc:350
|
#41 0x00005555562ac4e3 in Item_func_case::fix_fields (this=0x7fffa0018e30, thd=0x7fffa0000d78, ref=0x7fffa0018f80) at /home/psergey/dev-git2/10.6/sql/item_cmpfunc.cc:3150
|
#42 0x0000555555d8ad26 in Item::fix_fields_if_needed (this=0x7fffa0018e30, thd=0x7fffa0000d78, ref=0x7fffa0018f80) at /home/psergey/dev-git2/10.6/sql/item.h:1147
|
#43 0x0000555555d8ad53 in Item::fix_fields_if_needed_for_scalar (this=0x7fffa0018e30, thd=0x7fffa0000d78, ref=0x7fffa0018f80) at /home/psergey/dev-git2/10.6/sql/item.h:1156
|
#44 0x0000555555e0f127 in setup_fields (thd=0x7fffa0000d78, ref_pointer_array={m_array = 0x7fffa0028760, m_size = 199}, fields=@0x7fffa0017b38: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7fffa0018f78, last = 0x7fffa0018f78, elements = 1}, <No data fields>}, column_usage=MARK_COLUMNS_READ, sum_func_list=0x7fffa0991268, pre_fix=0x7fffa0017b50, allow_sum_func=true) at /home/psergey/dev-git2/10.6/sql/sql_base.cc:7735
|
#45 0x0000555555efe71a in JOIN::prepare (this=0x7fffa0990f08, tables_init=0x7fffa098ffe0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fffa0017880, unit_arg=0x7fffa00050e8) at /home/psergey/dev- git2/10.6/sql/sql_select.cc:1437
|
#46 0x0000555555f0be14 in mysql_select (thd=0x7fffa0000d78, tables=0x7fffa098ffe0, fields=@0x7fffa0017b38: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7fffa0018f78, last = 0x7fffa0018f78, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fffa09ae868, unit=0x7fffa00050e8, select_lex=0x7fffa0017880) at /home/psergey/dev-git2/10.6/sql/sql_select.cc:5046
|
As far as I understand, if one calls walk() for the Item object representing s9,
- we will visit the Item object representing s8 9 times (as s9 has 9 pointers to s8)
- we will visit the Item object representing s7 9^2 = 81 times (s8 has 9 pointers to s7)
- and so forth
Rougly speaking, at depth-most level it's fanout ^ depth = 10^8 calls. That's why the query is slow.
|