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

Method save_explain_data_intern

sql/sql_select.cc:31620–31802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31618*/
31619
31620int JOIN::save_explain_data_intern(Explain_query *output,
31621 bool need_tmp_table_arg,
31622 bool need_order_arg, bool distinct_arg,
31623 const char *message)
31624{
31625 JOIN *join= this; /* Legacy: this code used to be a non-member function */
31626 DBUG_ENTER("JOIN::save_explain_data_intern");
31627 DBUG_PRINT("info", ("Select %p (%u), type %s, message %s",
31628 join->select_lex, join->select_lex->select_number,
31629 join->select_lex->type,
31630 message ? message : "NULL"));
31631 DBUG_ASSERT(have_query_plan == QEP_AVAILABLE);
31632 /* fake_select_lex is created/printed by Explain_union */
31633 DBUG_ASSERT(join->select_lex != join->unit->fake_select_lex);
31634
31635 /* There should be no attempts to save query plans for merged selects */
31636 DBUG_ASSERT(!join->select_lex->master_unit()->derived ||
31637 join->select_lex->master_unit()->derived->is_materialized_derived() ||
31638 join->select_lex->master_unit()->derived->is_with_table());
31639
31640 /* Don't log this into the slow query log */
31641
31642 if (message)
31643 {
31644 if (!(explain= new (output->mem_root)
31645 Explain_select(output->mem_root,
31646 thd->lex->analyze_stmt)))
31647 DBUG_RETURN(1);
31648#ifndef DBUG_OFF
31649 explain->select_lex= select_lex;
31650#endif
31651 join->select_lex->set_explain_type(true);
31652
31653 explain->select_id= join->select_lex->select_number;
31654 explain->select_type= join->select_lex->type;
31655 explain->linkage= select_lex->get_linkage();
31656 explain->using_temporary= need_tmp;
31657 explain->using_filesort= need_order_arg;
31658 /* Setting explain->message means that all other members are invalid */
31659 explain->message= message;
31660
31661 if (select_lex->master_unit()->derived)
31662 explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
31663 if (save_agg_explain_data(this, explain))
31664 DBUG_RETURN(1);
31665
31666 output->add_node(explain);
31667 }
31668 else if (pushdown_query)
31669 {
31670 if (!(explain= new (output->mem_root)
31671 Explain_select(output->mem_root,
31672 thd->lex->analyze_stmt)))
31673 DBUG_RETURN(1);
31674 select_lex->set_explain_type(true);
31675
31676 explain->select_id= select_lex->select_number;
31677 explain->select_type= select_lex->type;

Callers

nothing calls this directly

Calls 15

save_agg_explain_dataFunction · 0.85
first_explain_order_tabFunction · 0.85
next_explain_order_tabFunction · 0.85
master_unitMethod · 0.80
is_with_tableMethod · 0.80
set_explain_typeMethod · 0.80
get_linkageMethod · 0.80
add_nodeMethod · 0.80
first_inner_unitMethod · 0.80
next_unitMethod · 0.80

Tested by

no test coverage detected