mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MWL#182: Explain running statements
First code - "Asynchronous procedure call" system - new THD::check_killed() that serves APC request is called from within most important loops - EXPLAIN code is now able to generate EXPLAIN output on-the-fly [incomplete] Parts that are still missing: - put THD::check_killed() call into every loop where we could spend significant amount of time - Make sure EXPLAIN code works for group-by queries that replace JOIN::join_tab with make_simple_join() and other such cases. - User interface: what error code to use, where to get timeout settings from, etc.
This commit is contained in:
@@ -328,6 +328,7 @@ void init_update_queries(void)
|
||||
sql_command_flags[SQLCOM_SHOW_ENGINE_STATUS]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_ENGINE_MUTEX]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_ENGINE_LOGS]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_EXPLAIN]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND;
|
||||
@@ -3402,6 +3403,32 @@ end_with_restore_list:
|
||||
thd->security_ctx->priv_user),
|
||||
lex->verbose);
|
||||
break;
|
||||
case SQLCOM_SHOW_EXPLAIN:
|
||||
{
|
||||
/* Same security as SHOW PROCESSLIST (TODO check this) */
|
||||
if (!thd->security_ctx->priv_user[0] &&
|
||||
check_global_access(thd,PROCESS_ACL))
|
||||
break;
|
||||
|
||||
Item *it= (Item *)lex->value_list.head();
|
||||
|
||||
if (lex->table_or_sp_used())
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "Usage of subqueries or stored "
|
||||
"function calls as part of this statement");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((!it->fixed && it->fix_fields(lex->thd, &it)) || it->check_cols(1))
|
||||
{
|
||||
my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
|
||||
MYF(0));
|
||||
goto error;
|
||||
}
|
||||
|
||||
mysqld_show_explain(thd, (ulong)it->val_int());
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SHOW_AUTHORS:
|
||||
res= mysqld_show_authors(thd);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user