Reindex
Rebuilds indices on tables.
Synopsis
REINDEX { TABLE | DATABASE | INDEX } name [ FORCE ]Parameters
TABLE | DATABASE | INDEXThe type of database object to be re-indexed.
nameThe name of the database object you wish to re-index.
FORCEThe
FORCEkeyword forces the rebuilding of all specified indices. If this parameter is not given, theREINDEXcommand will rebuild only invalidated indices.
Results
REINDEXThe 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