Name
REINDEX -- Rebuilds indices on tables.
Synopsis
REINDEX { TABLE | DATABASE | INDEX }
name
[ FORCE ]
Parameters
-
TABLE | DATABASE | INDEX
-
The type of database object to be re-indexed.
-
name
-
The name of the database object you wish to re-index.
-
FORCE
-
The FORCE keyword forces the rebuilding of all specified indices. If this parameter is not given, the REINDEX command will rebuild only invalidated indices.
Results
-
REINDEX
-
The message returned when a target object is successfully reindexed.
Description
Use the REINDEX command to rebuild any indices that have become corrupt. This is especially useful if system indices become corrupted. To fix them, shutdown
postmaster
and start it using the
-o "-O -P"
command-line parameter. This opens a standalone server that allows for re-indexing of system indices. Run the REINDEX DATABASE command once you are at the
psql
prompt.
Examples
The following example rebuilds all indices on the books table, within the booktown database:
booktown=#
REINDEX TABLE books;
REINDEX