Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > 3bfb3b1f341c3d2d573afbb1f9b24ba4 > files > 35

db6.1-sql-devel-6.1.29.0-1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Database Statistics</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with the Oracle Berkeley DB SQL APIs" />
    <link rel="up" href="admin.html" title="Chapter 5. Administrating Berkeley DB SQL Databases" />
    <link rel="prev" href="recoverysql.html" title="Catastrophic Recovery" />
    <link rel="next" href="verifysql.html" title="Verify Database Structure" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.1</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Database Statistics</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="recoverysql.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 5. Administrating Berkeley DB SQL Databases</th>
          <td width="20%" align="right"> <a accesskey="n" href="verifysql.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="statsql"></a>Database Statistics</h2></div></div></div><p>
                The statistics utility can be used to print out information on
                tables in a database.  A detailed description of the statistics
                utility is described at <a href="../api_reference/C/db_stat.html" class="olink">db_stat</a>
                  .  This
                section describes how to use the utility with a SQL database.
            </p><p>
                The first step in getting statistics on a table is to find the
                internal name for the table.  The internal table name is
                <code class="literal">table#####</code>, where the number is the rootpage
                number, which can be retrieved using the following SQL statement:
            </p><code class="code">
                SELECT rootpage FROM sqlite_master WHERE name='[table name]';
            </code>
                For example, if the root page is 10, the internal table name
                will be <code class="literal">table00010</code>.
            <p>
                In order to run the <span class="command"><strong>db_stat</strong></span> utility, 
                first add a <a href="../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
                     file to the journal directory.
                In the file, add the following line:
            </p><code class="code">
                add_data_dir ..
            </code><p>
                Then execute the following command in the directory
                with the database:
                <span class="command"><strong>db_stat -d [file name] -h [journal directory] -s [internal table name]</strong></span>.
                That command will print out information on the table.
            </p></div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="recoverysql.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="admin.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="verifysql.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Catastrophic Recovery </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Verify Database Structure</td>
        </tr>
      </table>
    </div>
  </body>
</html>