Trimming, purging, and archiving tables
You can trim or purge tables by using an SQL query tool. In a development system, using an SQL query tool is fast and often appropriate. As a best practice in a production setting, implement trimming and purging operations using activities, either run on request or run automatically by an agent.
Using an activity might be slower and more resource-intensive, but it helps ensure database integrity, handles errors, and causes internally maintained Index- instances to be deleted appropriately by Declare Index rules.
You can use the standard activity Log-.TrimLog to purge instances of one concrete class derived from the Log- base class, retaining instances less than N days old, where N is a parameter to the activity. This activity records the number of records trimmed in the Pega log file.
The Pega-RULES agent normally runs the standard Code-.SystemCleaner activity once each day for housekeeping tasks. You can add a similar activity to another agent in your application to purge outdated information and recover table space. Make sure that the new agent has access to the appropriate ruleset versions, and do not purge records that are referenced in other tables.
Work item purging and archiving
Work item details are stored as rows of many different tables. To purge work items or move them to an archive, it is important to remove all the pieces, and to remove only those work items that are not active. Use the Purge/Archive wizard to purge or archive work items and their details.