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:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of