<literal>_ccold</literal>,
it corresponds to the original index which could not be dropped;
the recommended recovery method is to just drop said index, since the
rebuild proper has been successful.
A nonzero number may be appended to the suffix of the invalid index
names to keep them unique, like <literal>_ccnew1</literal>,
<literal>_ccold2</literal>, etc.
</para>
<para>
Regular index builds permit other regular index builds on the same table
to occur simultaneously, but only one concurrent index build can occur on a
table at a time. In both cases, no other types of schema modification on
the table are allowed meanwhile. Another difference is that a regular
<command>REINDEX TABLE</command> or <command>REINDEX INDEX</command>
command can be performed within a transaction block, but <command>REINDEX
CONCURRENTLY</command> cannot.
</para>
<para>
Like any long-running transaction, <command>REINDEX</command> on a table
can affect which tuples can be removed by concurrent
<command>VACUUM</command> on any other table.
</para>
<para>
<command>REINDEX SYSTEM</command> does not support
<command>CONCURRENTLY</command> since system catalogs cannot be reindexed
concurrently.
</para>
<para>
Furthermore, indexes for exclusion constraints cannot be reindexed
concurrently. If such an index is named directly in this command, an
error is raised. If a table or database with exclusion constraint indexes
is reindexed concurrently, those indexes will be skipped. (It is possible
to reindex such indexes without the <command>CONCURRENTLY</command> option.)
</para>
<para>
Each backend running <command>REINDEX</command> will report its progress
in the <structname>pg_stat_progress_create_index</structname> view. See
<xref linkend="create-index-progress-reporting"/> for details.
</para>
</refsect2>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Rebuild a single index:
<programlisting>
REINDEX INDEX my_index;
</programlisting>
</para>
<para>
Rebuild all the indexes on the table <literal>my_table</literal>:
<programlisting>
REINDEX TABLE my_table;
</programlisting>
</para>
<para>
Rebuild all indexes in a particular database, without trusting the
system indexes to be valid already:
<programlisting>
$ <userinput>export PGOPTIONS="-P"</userinput>
$ <userinput>psql broken_db</userinput>
...
broken_db=> REINDEX DATABASE broken_db;
broken_db=> \q
</programlisting></para>
<para>
Rebuild indexes for a table, without blocking read and write operations
on involved relations while reindexing is in progress:
<programlisting>
REINDEX TABLE CONCURRENTLY my_broken_table;
</programlisting></para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
There is no <command>REINDEX</command> command in the SQL standard.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createindex"/></member>
<member><xref linkend="sql-dropindex"/></member>
<member><xref linkend="app-reindexdb"/></member>
<member><xref linkend="create-index-progress-reporting"/></member>
</simplelist>
</refsect1>
</refentry>