<!--
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/reindex.sgml,v 1.1 2000/03/31 08:16:33 inoue Exp $
Postgres documentation
-->

<refentry id="SQL-REINDEX">
 <refmeta>
  <refentrytitle id="SQL-REINDEX-TITLE">
   REINDEX
  </refentrytitle>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   REINDEX
  </refname>
  <refpurpose>
   Recover corrupted system indexes under standalone Postgres
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>2000-03-30</date>
  </refsynopsisdivinfo>
  <synopsis>
REINDEX { TABLE | DATABASE | INDEX } <replaceable class="PARAMETER">name</replaceable> [ FORCE ]
  </synopsis>
  
  <refsect2 id="R2-SQL-REINDEX-1">
   <refsect2info>
    <date>2000-03-30</date>
   </refsect2info>
   <title>
    Inputs
   </title>
   <para>

    <variablelist>
     <varlistentry>
      <term>TABLE</term>
      <listitem>
       <para>
	Recreate all indexes of a specfied table.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term>DATABASE</term>
      <listitem>
       <para>
	Recreate all system indexes of a specfied database.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term>INDEX</term>
      <listitem>
       <para>
	Recreate a specfied index.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term><replaceable class="PARAMETER">name</replaceable></term>
      <listitem>
       <para>
	The name of the specific table/database/index to be be reindexed.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term>FORCE</term>
      <listitem>
       <para>
	Recreate indexes forcedly. Without this keyword REINDEX does
	nothing unless target indexes are invalidated.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
  
  <refsect2 id="R2-SQL-REINDEX-2">
   <refsect2info>
    <date>2000-03-30</date>
   </refsect2info>
   <title>
    Outputs
   </title>
   <para>

    <variablelist>
     <varlistentry>
      <term><computeroutput>
REINDEX
       </computeroutput></term>
      <listitem>
       <para>
	Message returned if the table is successfully reindexed.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
 </refsynopsisdiv>

 <refsect1 id="R1-SQL-REINDEX-1">
  <refsect1info>
   <date>2000-03-30</date>
  </refsect1info>
  <title>
   Description
  </title>
  <para>
   <command>REINDEX</command> is used to recover corrupted system indexes.
    In order to run REINDEX command,Postmaster must be shutdown and 
    standalone Postgres should be started instead with options -O and
    -P(an option to ignore system indexes).  Note that we couldn't rely
    on system indexes for the recovery of system indexes.
  </para>
 </refsect1>

 <refsect1 id="R1-SQL-REINDEX-2">
  <title>
   Usage
  </title>
  <para>
   Recreate the table <literal>mytable</literal>:

   <programlisting>
     REINDEX TABLE mytable;
   </programlisting>
  </para>

  <para>
   Some more examples:

   <programlisting>
REINDEX DATABASE my_database FORCE;
REINDEX INDEX my_index;
   </programlisting>
  </para>
 </refsect1>
 
 <refsect1 id="R1-SQL-REINDEX-3">
  <title>
   Compatibility
  </title>
  
  <refsect2 id="R2-SQL-REINDEX-4">
   <refsect2info>
    <date>2000-03-30</date>
   </refsect2info>
   <title>
    SQL92
   </title>
   <para>
    There is no <command>REINDEX</command> in <acronym>SQL92</acronym>.
   </para>
  </refsect2>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
