What is a revision?
A revision is a copy of a database at a given time.
Why should we get rid of unused revisions?
The usage of revisions is necessary for safe recovery from crises and for the function of the Management High-Availability architecture, among others.
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:
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"
# 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"
# mgmt_cli -r true purge-published-sessions number-of-sessions-to-preserve 1 -d "Global"
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.