mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.10 into 10.11
This commit is contained in:
@@ -188,7 +188,7 @@ void Explain_query::notify_tables_are_closed()
|
||||
Send EXPLAIN output to the client.
|
||||
*/
|
||||
|
||||
int Explain_query::send_explain(THD *thd)
|
||||
int Explain_query::send_explain(THD *thd, bool extended)
|
||||
{
|
||||
select_result *result;
|
||||
LEX *lex= thd->lex;
|
||||
@@ -201,8 +201,22 @@ int Explain_query::send_explain(THD *thd)
|
||||
if (thd->lex->explain_json)
|
||||
print_explain_json(result, thd->lex->analyze_stmt, false /*is_show_cmd*/);
|
||||
else
|
||||
{
|
||||
res= print_explain(result, lex->describe, thd->lex->analyze_stmt);
|
||||
|
||||
if (extended)
|
||||
{
|
||||
char buff[1024];
|
||||
String str(buff,(uint32) sizeof(buff), system_charset_info);
|
||||
str.length(0);
|
||||
/*
|
||||
The warnings system requires input in utf8, @see
|
||||
mysqld_show_warnings().
|
||||
*/
|
||||
lex->unit.print(&str, QT_EXPLAIN_EXTENDED);
|
||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_YES, str.c_ptr_safe());
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
result->abort_result_set();
|
||||
else
|
||||
@@ -212,6 +226,7 @@ int Explain_query::send_explain(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
The main entry point to print EXPLAIN of the entire query
|
||||
*/
|
||||
@@ -2005,12 +2020,35 @@ void Explain_table_access::print_explain_json(Explain_query *query,
|
||||
|
||||
if (is_analyze)
|
||||
{
|
||||
//writer->add_member("r_loops").add_ll(jbuf_tracker.get_loops());
|
||||
writer->add_member("r_loops").add_ll(jbuf_loops_tracker.get_loops());
|
||||
|
||||
writer->add_member("r_filtered");
|
||||
if (jbuf_tracker.has_scans())
|
||||
writer->add_double(jbuf_tracker.get_filtered_after_where()*100.0);
|
||||
else
|
||||
writer->add_null();
|
||||
|
||||
writer->add_member("r_unpack_time_ms");
|
||||
writer->add_double(jbuf_unpack_tracker.get_time_ms());
|
||||
|
||||
writer->add_member("r_other_time_ms").
|
||||
add_double(jbuf_extra_time_tracker.get_time_ms());
|
||||
/*
|
||||
effective_rows is average number of matches we got for an incoming
|
||||
row. The row is stored in the join buffer and then is read
|
||||
from there, possibly multiple times. We can't count this number
|
||||
directly. Infer it as:
|
||||
total_number_of_row_combinations_considered / r_loops.
|
||||
*/
|
||||
writer->add_member("r_effective_rows");
|
||||
if (jbuf_loops_tracker.has_scans())
|
||||
{
|
||||
double loops= (double)jbuf_loops_tracker.get_loops();
|
||||
double row_combinations= (double)jbuf_tracker.r_rows;
|
||||
writer->add_double(row_combinations / loops);
|
||||
}
|
||||
else
|
||||
writer->add_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user