Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27188

Suppress optimizer output when executing prepare

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Optimizer
    • None

    Description

      Filing this based on igor's input on Slack:

      Igor wrote:

      No, I want to suppress output to optimizer only when executing PREPARE. I actually would like not to have anything in opt trace after having executed PREPARE stmt FROM ... . LEX::context_analysis_only & CONTEXT_ANALYSIS_ONLY_PREPARE tells you that you are executing PREPARE stmt FROM

      I've got no clue why this is needed but let's implement it.

      Initial patch:

      diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc
      index ba9220cac44..80c51eb006c 100644
      --- a/sql/opt_trace.cc
      +++ b/sql/opt_trace.cc
      @@ -489,7 +489,8 @@ Opt_trace_start::Opt_trace_start(THD *thd, TABLE_LIST *tbl,
             !list_has_optimizer_trace_table(tbl) &&
             !sets_var_optimizer_trace(sql_command, set_vars) &&
             !thd->system_thread &&
      -      !ctx->disable_tracing_if_required())
      +      !ctx->disable_tracing_if_required() &&
      +      !(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_PREPARE))
         {
           ctx->start(thd, tbl, sql_command, query, query_length, query_charset,
                      thd->variables.optimizer_trace_max_mem_size);
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.