Support Center > Search Results > SecureKnowledge Details
Automatic Revisions Purge: overview and how-to Technical Level
What is a revision?

A revision is a copy of a database at a given time. 

The usage of revisions is necessary for safe recovery from crises and for the function of the Management High-Availability architecture, among others. 
Why should we get rid of unused revisions?

In order for Postgres to complete certain operations, it will require the checking of all existing revisions stored on the server.  

The fewer revisions there are to check, the faster Postgres will be able to complete certain tasks.

The collecting of unused revisions likewise leads to the ballooning of your database in size, which leads to other performance issues.

How can revisions be purged automatically?

Automatic revision purging is an important maintenance operation that can be used to clear unused data and thus reduce disk space usage and improve the performance.

Automatic revision purging gives the user the ability to execute the purge operation as a scheduled task and according to parameters of the user's choosing.

Best Practice - We recommend to configure automatic revisions purge to run one time during a month and configure it to purge all revisions that are older than ten days.

Using the Management API guide, you can configure the state of the automatic revision purging (on/off) and configure it according to a number of parameters, including the number of overall sessions and/or a set age.

The configuration is done on the active Management Server.

This feature is implemented in:

A note for MDS environments: You must add the --d/--domain <domain> flag for each Domain, on which you wish to configure automatic purging.
In R81.10 and above automatic purge cannot be configured in System domain (MDS level) and Global domain.

To run the purge from the MGMT API using the Expert mode, the steps would be as follows:

Change MDS context to MDS level:

# mdsenv

Purge MDS Level Revisions (System Data):

# mgmt_cli -r true purge-published-sessions number-of-sessions-to-preserve <int/number_of_rev_to_preserve> -d "System Data"

For example:

# mgmt_cli -r true purge-published-sessions number-of-sessions-to-preserve 1 -d "System Data"

Purge Global Domain Revisions:

 # mgmt_cli -r true purge-published-sessions number-of-sessions-to-preserve <int/number_of_rev_to_preserve> -d "Global"

 For example:

# mgmt_cli -r true purge-published-sessions number-of-sessions-to-preserve 1 -d "Global"

Additional Note:
It is possible to enable both: "keep sessions by count" & "keep sessions by time", what will happen is the following:
In case both are enabled then both will be checked on how many revisions will be deleted and then the lesser one will be chosen to avoid any conflict of deleting revisions that the customer doesn't wish to delete.

Give us Feedback
Please rate this document