Data archiving

The archive application moves data that is no longer necessary for immediate day-to-day access from primary tables into a set of archive tables.

The longer an instance runs, the more likely it is to accumulate data that is no longer relevant to current business needs. For example, task records from two years ago are typically less relevant than currently active tasks. Old data may eventually cause performance issues by consuming system resources and slowing down queries and reports. If you cannot delete this data because you need it for auditing or for historical purposes, set up an archive rule to archive the data and remove it from immediate access to free up system resources. You can then set up a destroy rule to delete the data after a specified period of time. Destroy rules are available starting with the Helsinki release.

Figure 1. Sample Benefits of Archiving Data

Data archiving supports domain separation. For example, incidents that belong to a domain keep their domain designation even after they are archived.

Note: If you want to archive email, activate the Email retention plugin and use the archive and destruction rules that come with the plugin. Do not use the archive feature to create your own archiving rules on the Email table.

Tables and modules created by an archive rule

The first time you activate an archive rule, it performs the following actions:

  • Creates the archive table in the database. The archive table has the same name as the primary table with an "ar_" prefix. For example, if you archive the Incident [incident] table, then the archive table is [ar_incident].
  • Converts multiple joined tables into a single flat-file archive table. The archive table no longer consists of a base and extended tables.
  • Converts reference field values (values set by references to records in other tables) into string values. The archive record contains the display value of the reference field at the time of the archive.
  • Adds a module to the Archive Tables list in the System Archiving application. The module name is a combination of the word "Archive" plus the display name for the archived table. For example, the archive module for the Attachment [sys_attachments] table is Archive Attachment. Click the module name to view records in the archive table.
  • Creates a list of the archive table using the default list view.
  • Creates a form for the archive table using the default form view. The form excludes any dot-walking fields such as Caller ID.Email.
  • Creates an activity formatter and variable formatter if they exist for the table being archived.
Figure 2. Conversion of Multiple Joined Tables into a Flat Archive Table

Querying archived data

Archived tables are not optimized for ad hoc queries. They only contain index entries for the display value, creation date, and the primary key of sys_id.

For this reason ServiceNow does not recommend making ad hoc queries against an archived table, such as searching for all priority 1 archived incidents. Instead, only search against the indexed fields. For example, search for incident INC100001 or incidents created on a specific date.