10.0 Cleaning Database and Generating Internal Statistics

PostgreSQL required a strong maintenance mechanism to deal with these DEAD tuples and statistics. VACUUM is the maintenance process which takes care of DEAD tuples along with it analyzes the contents of a tables and collects statistics about the distribution of values in each column of every table.

Perform the following steps to clean the PostgreSQL database:

  1. Login to the Primary Server that has the database role.

  2. Run the following command to VACUUM on all databases:

    • docker exec -it -e PGPORT=<postgresql port> -e PGUSER=<super user retrieved from zman dgcs> -e PGDATABASE=postgres -e PGPASSWORD=<password retrieved from zman dgcs> zenpostgres vacuumdb --analyze --full --skip-locked --verbose --all

      By default, ZENworks uses 54327 as the PostgreSQL port.

NOTE:

  • Currently, the automatic PostgreSQL backup/vacuum process does not include the Antimalware database. In zones where Antimalware is enabled, you should execute the following command to ensure that the Antimalware database is enabled for backup:

    docker exec -it -e PGPORT=<postgresql port> -e PGUSER=<super user retrieved from zman dgcs> -e PGDATABASE=postgres -e PGPASSWORD=<password retrieved from zman dgcs> zenpostgres vacuumdb --analyze --full --skip-locked --verbose --all

    By default, ZENworks uses 54327 as the PostgreSQL port.

  • It is recommends to run these steps every week during the low activity on the database (non-business hours).

    For more information, see https://www.postgresql.org/docs/current/app-vacuumdb.html