postgresql_16:7.1.161.4 Examples
PostgreSQL 16 > Reference > SQL Commands > REINDEX > Examples
Rebuild a single index: REINDEX INDEX my_index;
Rebuild all the indexes on the table my_table: REINDEX TABLE my_table;
Rebuild all indexes in a particular database, without trusting the system indexes to be valid already: $ export PGOPTIONS="-P" $ psql broken_db ... broken_db=> REINDEX DATABASE broken_db; broken_db=> \q
Rebuild indexes for a table, without blocking read and write operations on involved relations while reindexing is in progress: REINDEX TABLE CONCURRENTLY my_broken_table;