50.1. Creating a Housekeeping Rule #
In the navigation panel, go to Settings → Repository.
In the top-right corner of the page, click Create rule.
Specify parameters of the new housekeeping rule (parameters marked with an asterisk are required):
Instance: The instance where the repository database is located.
Name.
Schema: The schema where the table is located.
Table: The table that will be cleaned.
Timestamp column: The table column that contains the timestamp for determining the data age.
Maximum storage time: The maximum time the table data can be stored before deletion.
Specify a value in one of the following formats:
<, for example,number_of_hours>h<number_of_minutes>m24h00m<, for example,number_of_hours>h24h<, for example,number_of_minutes>m24m
Auto-run schedule: Specifies whether the housekeeping rule is auto-run or not.
If this toggle is turned on, specify the interval for cleaning the table in one of the following ways:
In Crontab interval, enter the string in the crontab format.
Click Configure schedule, and then specify the following parameters:
Interval: The unit of measurement of the interval.
Possible values:
Minutes
Hours
Days
Repeat every: The interval for cleaning the table by minutes or hours.
This parameter is available only if you select Minutes or Hours from Interval.
Execution days: The days when the table will be cleaned.
Cron total line: The string in the crontab format that specifies the time interval for cleaning the table.
After configuring the interval, click Save.
Description.
Additional conditions: Housekeeping rule conditions.
To add a housekeeping rule condition, click Add condition, and then specify the following parameters:
Field: The table field for the housekeeping rule condition.
Condition: The logical operator of the housekeeping rule condition.
Possible values:
=
≠
IN
NOT IN
LIKE
NOT LIKE
>
<
≥
≤
REGEXP
NOT REGEXP
Value type: The type of the value of the housekeeping rule condition.
Possible values:
Literal
Function
Currently, the only function you can use is
now. This function takes the current timestamp.
Value: The value of the housekeeping rule condition.
For example, if you select oid from Field, = from Condition, Literal from Value type, and enter
10in Value, the data is deleted if the value of theoidtable field is equal to10.After configuring the housekeeping rule condition, click Save.
You can add multiple housekeeping rule conditions by clicking Add condition. In this case, the
ANDlogical connective is used.Action after cleaning: The action that will be performed after cleaning the table.
To add an action, click Add action, and then select the action. Currently, the only supported action is table vacuuming.
You can also enable the following checkboxes:
Analyze: Update the table statistics.
Full: Run the
VACUUM FULLcommand.In this case, more data is vacuumed, but the operation takes longer to complete and locks the table.
Freeze: Perform an aggressive tuple freeze.
This is equivalent to running the
VACUUMcommand with thevacuum_freeze_min_ageparameter set to0.
After adding the action, click Save.
You can add multiple actions by clicking Add action.
Click Create.