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

Method print_explain

sql/sql_lex.cc:6220–6250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6218*/
6219
6220int LEX::print_explain(select_result_sink *output, uint8 explain_flags,
6221 bool is_analyze, bool is_json_format,
6222 bool *printed_anything)
6223{
6224 int res;
6225 if (explain && explain->have_query_plan())
6226 {
6227 if (is_json_format)
6228 {
6229 auto now= microsecond_interval_timer();
6230 auto start_time= thd->start_utime;
6231 auto query_time_in_progress_ms= 0ULL;
6232 if (likely(now > start_time))
6233 query_time_in_progress_ms=
6234 (now - start_time) / (HRTIME_RESOLUTION / 1000);
6235 res= explain->print_explain_json(output, is_analyze,
6236 query_time_in_progress_ms);
6237 }
6238 else
6239 {
6240 res= explain->print_explain(output, explain_flags, is_analyze);
6241 }
6242 *printed_anything= true;
6243 }
6244 else
6245 {
6246 res= 0;
6247 *printed_anything= false;
6248 }
6249 return res;
6250}
6251
6252
6253/**

Callers 2

call_in_target_threadMethod · 0.45
execute_sqlcom_selectFunction · 0.45

Calls 2

have_query_planMethod · 0.80
print_explain_jsonMethod · 0.80

Tested by

no test coverage detected