<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="show-open-tables">
      </a>
      15.7.7.25 SHOW OPEN TABLES Statement
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045170100480">
  </a>
  <a class="indexterm" name="idm46045170098608">
  </a>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34400816"><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 keyword">SHOW</span> <span class="token keyword">OPEN</span> <span class="token keyword">TABLES</span>
    <span class="token punctuation">[</span>{<span class="token keyword">FROM</span> <span class="token operator">|</span> <span class="token keyword">IN</span>} <em class="replaceable">db_name</em><span class="token punctuation">]</span>
    <span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">pattern</em>'</span> <span class="token operator">|</span> <span class="token keyword">WHERE</span> <em class="replaceable">expr</em><span class="token punctuation">]</span></code></pre>
  </div>
  <p>
   <a class="link" href="show-open-tables.html" title="15.7.7.25 SHOW OPEN TABLES Statement">
    <code class="literal">
     SHOW OPEN TABLES
    </code>
   </a>
   lists the
        non-
   <code class="literal">
    TEMPORARY
   </code>
   tables that are currently open
        in the table cache. See
   <a class="xref" href="table-cache.html" title="10.4.3.1 How MySQL Opens and Closes Tables">
    Section 10.4.3.1, “How MySQL Opens and Closes Tables”
   </a>
   . The
   <code class="literal">
    FROM
   </code>
   clause, if present, restricts the tables
        shown to those present in the
   <em class="replaceable">
    <code>
     db_name
    </code>
   </em>
   database. The
   <a class="link" href="string-comparison-functions.html#operator_like">
    <code class="literal">
     LIKE
    </code>
   </a>
   clause, if
        present, indicates which table names to match. The
   <code class="literal">
    WHERE
   </code>
   clause can be given to select rows
        using more general conditions, as discussed in
   <a class="xref" href="extended-show.html" title="28.8 Extensions to SHOW Statements">
    Section 28.8, “Extensions to SHOW Statements”
   </a>
   .
  </p>
  <p>
   <a class="link" href="show-open-tables.html" title="15.7.7.25 SHOW OPEN TABLES Statement">
    <code class="literal">
     SHOW OPEN TABLES
    </code>
   </a>
   output has these
        columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       Database
      </code>
     </p>
     <p>
      The database containing the table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Table
      </code>
     </p>
     <p>
      The table name.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       In_use
      </code>
     </p>
     <p>
      The number of table locks or lock requests there are for the
            table. For example, if one client acquires a lock for a
            table using
      <code class="literal">
       LOCK TABLE t1 WRITE
      </code>
      ,
      <code class="literal">
       In_use
      </code>
      is 1. If another client issues
      <code class="literal">
       LOCK TABLE t1 WRITE
      </code>
      while the table
            remains locked, the client blocks, waiting for the lock, but
            the lock request causes
      <code class="literal">
       In_use
      </code>
      to be 2.
            If the count is zero, the table is open but not currently
            being used.
      <code class="literal">
       In_use
      </code>
      is also increased by
            the
      <a class="link" href="handler.html" title="15.2.5 HANDLER Statement">
       <code class="literal">
        HANDLER ...
            OPEN
       </code>
      </a>
      statement and decreased by
      <a class="link" href="handler.html" title="15.2.5 HANDLER Statement">
       <code class="literal">
        HANDLER ...
            CLOSE
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Name_locked
      </code>
     </p>
     <p>
      Whether the table name is locked. Name locking is used for
            operations such as dropping or renaming tables.
     </p>
    </li>
   </ul>
  </div>
  <p>
   If you have no privileges for a table, it does not show up in
        the output from
   <a class="link" href="show-open-tables.html" title="15.7.7.25 SHOW OPEN TABLES Statement">
    <code class="literal">
     SHOW OPEN TABLES
    </code>
   </a>
   .
  </p>
 </div>
 <br/>
</div>
