Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2017 January PostgreSQL: Rebuild all Indexes using REINDEXDB utility and REINDEX command

PostgreSQL: Rebuild all Indexes using REINDEXDB utility and REINDEX command

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

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:

1
REINDEX DATABASE Database_Name;

Reindex on particular Index:

1
REINDEX INDEX Index_Name;

Reindex on particular Table:

1
REINDEX TABLE Table_Name;

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:

1
2
C:\Program Files\PostgreSQL\9.5\bin> reindexdb.exe -U user_name -a
Password:****

Reindex on particular Database:

1
2
C:\Program Files\PostgreSQL\9.5\bin> reindexdb.exe -d database -U user_name
Password:****

Reindex on particular Table:

1
2
C:\Program Files\PostgreSQL\9.5\bin> reindexdb.exe -d database_name -U user_name -t table_name
Password:****

Jan 5, 2017Anvesh Patel
SQL Server: Filtered Indexes - Improved the query performanceSQL Server: Important Discussion about the Latches
Comments: 2
  1. Raju
    May 24, 2019 at 6:00 am

    Hi Anvesh,

    Thanks for the blog , appreciate your efforts.

    Do we need to Rebuild Index after ‘VACUUM FULL’ ?if not how to check Last index rebuild timestamp.
    Specific to Version >9.0.

    Thanks
    Raju

  2. Katiejorie
    October 28, 2019 at 10:12 pm

    https://bit.ly/2BvP0nn – tiktok nudes

Anvesh Patel
Anvesh Patel

Database Engineer

January 5, 2017 PostgreSQLAnvesh Patel, database, database research and development, dbrnd, index, plpgsql, Postgres Query, postgresql, PostgreSQL Administrator, PostgreSQL Error, PostgreSQL Programming, PostgreSQL Tips and Tricks, Rebuild Index, reindex, reindexdb
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....