<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="sys-ps-setup-save">
      </a>
      30.4.4.14 The ps_setup_save() Procedure
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045061405472">
  </a>
  <a class="indexterm" name="idm46045061404000">
  </a>
  <p>
   Saves the current Performance Schema configuration. This
          enables you to alter the configuration temporarily for
          debugging or other purposes, then restore it to the previous
          state by invoking the
   <a class="link" href="sys-ps-setup-reload-saved.html" title="30.4.4.12 The ps_setup_reload_saved() Procedure">
    <code class="literal">
     ps_setup_reload_saved()
    </code>
   </a>
   procedure.
  </p>
  <p>
   To prevent other simultaneous calls to save the configuration,
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   acquires an
          advisory lock named
   <code class="literal">
    sys.ps_setup_save
   </code>
   by
          calling the
   <a class="link" href="locking-functions.html#function_get-lock">
    <code class="literal">
     GET_LOCK()
    </code>
   </a>
   function.
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   takes
          a timeout parameter to indicate how many seconds to wait if
          the lock already exists (which indicates that some other
          session has a saved configuration outstanding). If the timeout
          expires without obtaining the lock,
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   fails.
  </p>
  <p>
   It is intended you call
   <a class="link" href="sys-ps-setup-reload-saved.html" title="30.4.4.12 The ps_setup_reload_saved() Procedure">
    <code class="literal">
     ps_setup_reload_saved()
    </code>
   </a>
   later
          within the
   <span class="emphasis">
    <em>
     same
    </em>
   </span>
   session as
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   because the
          configuration is saved in
   <code class="literal">
    TEMPORARY
   </code>
   tables.
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   drops the
          temporary tables and releases the lock. If you end your
          session without invoking
   <a class="link" href="sys-ps-setup-save.html" title="30.4.4.14 The ps_setup_save() Procedure">
    <code class="literal">
     ps_setup_save()
    </code>
   </a>
   , the tables and
          lock disappear automatically.
  </p>
  <p>
   This procedure disables binary logging during its execution by
          manipulating the session value of the
   <a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
    <code class="literal">
     sql_log_bin
    </code>
   </a>
   system variable.
          That is a restricted operation, so the procedure requires
          privileges sufficient to set restricted session variables. See
   <a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
    Section 7.1.9.1, “System Variable Privileges”
   </a>
   .
  </p>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-setup-save-parameters">
       </a>
       Parameters
      </h5>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        in_timeout INT
       </code>
       : How many seconds to
                wait to obtain the
       <code class="literal">
        sys.ps_setup_save
       </code>
       lock. A negative timeout value means infinite timeout.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="sys-ps-setup-save-example">
       </a>
       Example
      </h5>
     </div>
    </div>
   </div>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57261237"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">CALL</span> sys<span class="token punctuation">.</span>ps_setup_save<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <em class="replaceable">make Performance <span class="token keyword">Schema</span> configuration changes</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">CALL</span> sys<span class="token punctuation">.</span>ps_setup_reload_saved<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
   </div>
  </div>
 </div>
 <br/>
</div>
