MCPcopy Create free account
hub / github.com/MariaDB/server / build_explain

Method build_explain

sql/sql_select.cc:1941–1985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1939
1940
1941bool JOIN::build_explain()
1942{
1943 DBUG_ENTER("JOIN::build_explain");
1944 have_query_plan= QEP_AVAILABLE;
1945
1946 /*
1947 explain data must be created on the Explain_query::mem_root. Because it's
1948 just a memroot, not an arena, explain data must not contain any Items
1949 */
1950 MEM_ROOT *old_mem_root= thd->mem_root;
1951 Item *old_free_list __attribute__((unused))= thd->free_list;
1952 thd->mem_root= thd->lex->explain->mem_root;
1953 bool res= save_explain_data(thd->lex->explain, false /* can overwrite */,
1954 need_tmp,
1955 !skip_sort_order && !no_order && (order || group_list),
1956 select_distinct);
1957 thd->mem_root= old_mem_root;
1958 DBUG_ASSERT(thd->free_list == old_free_list); // no Items were created
1959 if (res)
1960 DBUG_RETURN(1);
1961 uint select_nr= select_lex->select_number;
1962 JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt();
1963 for (uint i= 0; i < aggr_tables; i++, curr_tab++)
1964 {
1965 if (select_nr == FAKE_SELECT_LEX_ID)
1966 {
1967 /* this is a fake_select_lex of a union */
1968 select_nr= select_lex->master_unit()->first_select()->select_number;
1969 curr_tab->tracker= thd->lex->explain->get_union(select_nr)->
1970 get_tmptable_read_tracker();
1971 }
1972 else if (select_nr < INT_MAX)
1973 {
1974 Explain_select *tmp= thd->lex->explain->get_select(select_nr);
1975 if (tmp)
1976 curr_tab->tracker= tmp->get_using_temporary_read_tracker();
1977 }
1978 }
1979 if (is_in_subquery())
1980 {
1981 Item_in_subselect *subq= unit->item->get_IN_subquery();
1982 subq->init_subq_materialization_tracker(thd);
1983 }
1984 DBUG_RETURN(0);
1985}
1986
1987
1988int JOIN::optimize()

Callers

nothing calls this directly

Calls 7

first_selectMethod · 0.80
master_unitMethod · 0.80
get_unionMethod · 0.80
get_selectMethod · 0.45
get_IN_subqueryMethod · 0.45

Tested by

no test coverage detected