The vCenter appliance has it’s own local database. Behind the scenes it is running a vPostgres to store information for the hosts and clusters it is manageing. Over time the database tables can become fragmented and impact performance. Always snapshot or backup your appliance before attempting this procedure. NOTE: This procedure is not currently supported by VMware. Use at your own risk. This has only been tested on vCenter 5.5 appliance. I will be testing older versions soon.
1. Login to vCenter and take a snapshot of your vCenter Appliance VM. If this is the only vCenter take note of the host the vCenter Appliance is currently running on. In case vCenter stops responding you may need to connect directly to the ESX host to revert the snapshot.
2. Login to the vCenter appliance as root or sudo to root and change directory to /opt/vmware/vpostgres/current/bin/
3. Type: ./reindexdb –dbname VCDB –username vc and press enter
3.1 You should see a bunch of Notices like the following screen indicating which tables were reindexed. NOTE: It may take a minute or two.
4. If you want to run this on a regular schedule, create a shell named reindexvcdb.sh with the following lines and save it
cd /opt/vmware/vpostgres/current/bin/ ./reindexdb --dbname VCDB --username vc