Understand purge runtime behavior
- Last UpdatedOct 28, 2024
- 1 minute read
The following steps occur during the purge process:
-
Determine the time range for each deletion cycle based on the requested time range broken into subsets, as defined by the system attribute Archive query window size (hours). This is performed to avoid long-running transactions against the database.
-
Determine if the first main table has related tables. If no related tables are found, then steps 3 and 4 are skipped.
-
Copy the primary key from the main table into memory (that is, to a temporary table). For example, for the wo table, the primary key is wo_id and the timestamp used is last_edit_at.
-
Delete the related table information for which the primary key matches the records in the temporary table. There is no check on the related table timestamp.
-
Delete the main table records. For example, when purging work order records, the records in the wo table would be deleted.
-
If no exception occurs, move on to the next main table (if more than one table was selected as part of the purge).
If an exception occurs, drop the temporary table, roll back deletions of any data in dependent tables (deletions of data in related tables cannot be rolled back), and move on to the next main table (if more than one table was selected as part of the purge). If a purge is run again with the same parameters and the error has been corrected, the new purge operation will pick up what was missed on the previous purge during which the exception occurred.