mirror of
https://github.com/MariaDB/server.git
synced 2026-05-04 14:15:33 +02:00
MDEV-5117: Explain for a query executed as a PS is not written into the slow log
- Save the query plan after the statement was executed so that its gets into the slow query log.
This commit is contained in:
parent
1e36cbfa39
commit
282ff783b1
1 changed files with 15 additions and 2 deletions
|
|
@ -3931,8 +3931,21 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
|||
|
||||
if (! cursor)
|
||||
cleanup_stmt();
|
||||
|
||||
delete_explain_query(thd->lex);
|
||||
|
||||
/*
|
||||
EXECUTE command has its own dummy "explain data". We don't need it,
|
||||
instead, we want to keep the query plan of the statement that was
|
||||
executed.
|
||||
*/
|
||||
if (!stmt_backup.lex->explain ||
|
||||
!stmt_backup.lex->explain->have_query_plan())
|
||||
{
|
||||
delete_explain_query(stmt_backup.lex);
|
||||
stmt_backup.lex->explain = thd->lex->explain;
|
||||
thd->lex->explain= NULL;
|
||||
}
|
||||
else
|
||||
delete_explain_query(thd->lex);
|
||||
|
||||
thd->set_statement(&stmt_backup);
|
||||
thd->stmt_arena= old_stmt_arena;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue