1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-30032: EXPLAIN FORMAT=JSON output: print costs

Basic printout for join and table execution costs.
This commit is contained in:
Sergei Petrunia
2022-11-19 21:00:23 +03:00
parent 657868f5e7
commit ffe0beca25
91 changed files with 3441 additions and 18 deletions

View File

@@ -12021,6 +12021,7 @@ bool JOIN::get_best_combination()
j->records_init= j->records_out= j->records_read;
j->records= (ha_rows) j->records_read;
j->cond_selectivity= 1.0;
j->join_read_time= 0.0; /* Not saved currently */
JOIN_TAB *jt;
JOIN_TAB_RANGE *jt_range;
if (!(jt= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*sjm->tables)) ||
@@ -12081,6 +12082,7 @@ bool JOIN::get_best_combination()
j->records_init= cur_pos->records_init;
j->records_read= cur_pos->records_read;
j->records_out= cur_pos->records_out;
j->join_read_time= cur_pos->read_time;
loop_end:
j->cond_selectivity= cur_pos->cond_selectivity;
@@ -28585,6 +28587,7 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
explain_plan= eta;
eta->key.clear();
eta->quick_info= NULL;
eta->cost= join_read_time;
SQL_SELECT *tab_select;
/*
@@ -29198,6 +29201,7 @@ int JOIN::save_explain_data_intern(Explain_query *output,
table_map used_tables=0;
join->select_lex->set_explain_type(true);
xpl_sel->cost= best_read;
xpl_sel->select_id= join->select_lex->select_number;
xpl_sel->select_type= join->select_lex->type;
xpl_sel->linkage= select_lex->get_linkage();