diff options
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index c8cc64dba7e..6c3ad9c6924 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -112,6 +112,7 @@ When one supplies long data for a placeholder: #include "sp_cache.h" #include "sql_handler.h" // mysql_ha_rm_tables #include "probes_mysql.h" +#include "opt_trace.h" #ifdef EMBEDDED_LIBRARY /* include MYSQL_BIND headers */ #include <mysql.h> @@ -2273,6 +2274,17 @@ static bool check_prepared_statement(Prepared_statement *stmt) lex->first_select_lex()->context.resolve_in_table_list_only(select_lex-> get_table_list()); + /* + For the optimizer trace, this is the symmetric, for statement preparation, + of what is done at statement execution (in mysql_execute_command()). + */ + Opt_trace_start ots(thd, tables, lex->sql_command, &lex->var_list, + thd->query(), thd->query_length(), + thd->variables.character_set_client); + + Json_writer_object trace_command(thd); + Json_writer_array trace_command_steps(thd, "steps"); + /* Reset warning count for each query that uses tables */ if (tables) thd->get_stmt_da()->opt_clear_warning_info(thd->query_id); |