Data Center Network Manager (DCNM) - Vacuum and Autovacuum Postgres Databases
This chapter describes how to vacuum the postgres database in Microsoft Windows and Linux.
This chapter includes the following sections:
It is absolutely critical to vacuum postgres databases in order for the databases to properly function. Through the life of the database, new entries are added and current entries are updated. By design, postgres does not immediately remove the iterations of a record as it gets updated. Therefore, postgres databases can contain a large number of stale, unused records. These old records should be removed at least every two weeks with the vacuum function in order to reduce disk usage and improve the speed of database queries. It is even more effective if you configure postgres to automatically vacuum the database without the need to stop the Data Center Network Manager (DCNM) services.
Note $INSTALLDIR throughout this article refers to "C:\Program Files\Cisco Systems\" or "/usr/local/cisco/" based on the operating system, Microsoft Windows or Linux respectively. The install path could be changed from these defaults during installation.
Vacuum DCNM's Postgresql Database in Windows
Step 1 Stop the DCNM services by clicking Stop DCNM Servers button, or enter the command as below:
Step 2 Obtain the database name, username, and password. Locate the postgresql.cfg.xml file on the DCNM server.
In DCNM Version 6.2.x, enter:
In DCNM Version 6.3.x, enter:
Step 3 Open PgAdmin III.exe, which is a helpful GUI for the postgres database. Then, right-click the object in the list and connect to the database. Enter the password from Step 2 here.
Step 4 Navigate through the drop-down menus to the dcmdb database.
Step 5 Right-click dcmdb and select Maintenance. Select the Vacuum, Full, Analyze, and Verbose options in the Maintain Database dcmdb dialog box.
Note The vacuum operation usually completes within an hour, but can take much longer for larger databases. Remember to restart the DCNM services.
Vacuum DCNM's Postgresql Database in Linux
Step 1 Stop dcnm by using the appmgr stop dcnm command.
Step 2 Open the psql prompt:
./usr/local/cisco/dcm/db/bin/psql -U <dbUsername> dcmdb
Step 3 Run the database vacuum and quit:
dcmdb=> VACUUM FULL ANALYZE VERBOSE;
Many pages of output pass on the screen. The vacuum is finished when you see a message similar to this one:
Current limits are: 532000 page slots, 1000 relations, using 3182 kB.
The previous command exits the sql prompt.
Step 4 Start DCNM services by using the appmgr start dcnm command.