PostgreSQL: Rebuild all Indexes using REINDEXDB utility and REINDEX command

The Index Rebuilding is a very common and routine task for a Database Administrator.

All types of RDBMS system have various types of Reindexing option.
The Index Rebuilding is necessary periodically to remove fragmentation of Indexes.

PostgreSQL provides two ways to perform Reindexing on Database.

Using REINDEX command:

You can execute REINDEX command on Database, Table and Index.
You can connect PostgreSQL using PGAdmin or PSQL tools to execute this command.

Reindex all indexes of Database:

Reindex on particular Index:

Reindex on particular Table:

Using REINDEXDB.EXE utility:

A REINDEXDB is a one type of utility of PostgreSQL. It is an executable file which we can run without connect to database server.

A REINDEXDB requires command line arguments like database_username, database_name.
We can execute REINDEXDB using command prompt of the Operating System.

Below an example of Windows Command Prompt, the same way you can also execute in Linux.

Reindex all Database of PostgreSQL Server:

Reindex on particular Database:

Reindex on particular Table:

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of