Working with the PegaRULES database — Tables for history |
Four database tables initially contain history instances. These are insert-only tables, as new rows are added but existing rows are not ordinarily deleted or updated.
Work item history
Normal processing of a work item through one or more flow executions produces work item history instances. They document who updated the work item, when the update occurred, the assignment task or other task within the flow, and other facts. Agent processing and other automatic processing also may add to work item history.
These records support auditing needs and the detailed history display that is typically available from the History button on user forms.
Normally, all such instances are rows in the pc_history_work
table, which contains all classes derived from the History-Work- class. In terms of row count, this table often grows to become one of the largest in the PegaRULES database.
The pzInsKey for these instances is formed by concatenating the value of these properties:
For example, the pzInsKey value
HISTORY-PEGASAMPLE PEGASAMPLE C-43!20041109T204536.146 GMT
identifies a history record for the work item C-43 in the PegaSample work pool, added on November 9, 2004. The pxHistoryForReference value in this instance is PEGASAMPLE C-43.
A database view in the PegaRULES database provides an alternate means for reporting on work history. See Views and Indexes.
If a Data-Admin-DB-Table instance for a work item history class does not exist, the system by default saves the history instances in the pr_history
table. This does not provide best performance. See PDN article How to migrate work item history records that were incorrectly saved in the pr_history table.
Data object history
When you save a new or updated instance of an administrative data class, PRPC creates a corresponding history instance identifying the date, time, and operator who made the change.
These records support auditing needs and the detailed history display available from the History tab.
For example, when a calendar instance is updated — Data-Admin-Calendar class — the history instance is of class History-Data-Admin-Calendar.
Normally, all such instances are rows in the pr_history_data
table.
The pzInsKey for these instances is formed by concatenating the value of these properties:
For example, the pzInsKey value:
HISTORY-DATA-ADMIN-ORGANIZATION DATA-ADMIN-ORGANIZATION FORMCO ! 20051207T144054.968 GMT
identifies an organization data instance named FormCo that was updated on December 7, 2005 at 14:40 GMT.
When a rule is deleted, PRPC appends a row in the history table, as with other operations. The history rows are not deleted, although the rule that caused them to be recorded is gone.
Rule history
When a developer saves a new or updated instance of rule, PRPC creates a corresponding history instance identifying the date, time, and operator who made the change. For example, when a property is updated — Rule-Obj-Property class — the history instance is of class History-Rule.
These records support auditing needs, the Restore toolbar button, the Recover toolbar button, and the detailed history display available from the History tab. Normally, all such instances are rows in the pr4_history_rule
table.
The pzInsKey for these instances is formed by concatenating the value of these properties:
For example, the pzInsKey value:
HISTORY-RULE RULE-OBJ-PROPERTY DELTA-HR-OPS RNAME #20040927T234826.687 GMT!20051109T143059.254 GMT
identifies a change to a property named Rname that applies to the class Delta-HR-Ops. The property was created on September 27, 2004, and updated on November 9, 2005.
When a rule is deleted, PRPC appends a row in the history table, as with other operations. History rows are not deleted, although the rule that caused them to be recorded is gone.
Other history instances
The pr_history
table is associated with the History- base class, and holds rows for objects in concrete classes derived from History- other than those in the tables described above. For example, as initially configured during installation, instances recording the history of delegated rules (History-System-User-MyRules class) map to the pr_history
table.
The pr_history
table has only few exposed columns. As a best practice for performance, evolve your PegaRULES database schema so that no classes with many saved instances or high activity are mapped to the pr_history
table. Ensure that this table does not contain history instances for work items or data objects. Some applications in production may have thousands or millions of history records for high-turnover classes such as interest rates. As a best practice, create new dedicated tables with exposed columns for such classes, or add indexes to eliminate table scans and add exposed columns to avoid retrieving the Storage Stream. FITZI webinar 9/21/06
history type, History- base class, Storage Stream | |
Views and Indexes |