Working with the Pega 7 database — Tables for rules |
Twelve database tables normally contain rules. Rule instances are heavily indexed to speed the searching operations used in rule resolution.
The pzInsKey value for many types of rules is formed by concatenating the values of several properties:
For example, the pzInsKey value for the standard property Work-.pyStatusWork is:
RULE-OBJ-PROPERTY WORK- PYSTATUSWORK #20040927T235233.165 GMT
The RuleSet and version are not part of this value. Rules of the same name (same visible key parts) in different RuleSets or versions have a different creation date and time.
The pr4_rule_property
table contains property rules (Rule-Obj-Property rule type) and property qualifier rules (Rule-Obj-Property-Qualifier rule type).
Item |
Description |
Database table |
|
pzInsKey elements |
pxObjClass pyClassName pyPropertyName pxCreateDateTime |
Rows |
Over 10,000 standard properties, plus properties in your application RuleSets. |
Indexes |
Through multiple indexes, properties can be selected by Applies To class (pyClassName), RuleSet, RuleSet Version, and visible key (pxInsName). |
For example, the pzInsKey value for the property PegaSample.pyDueBy is:
RULE-OBJ-PROPERTY PEGASAMPLE PYDUEBY #20040927T235125.886 GMT
The pr4_rule_flow
table contains flows (Rule-Obj-Flow rule type).
Item |
Description |
Database table |
|
pzInsKey elements |
pxObjClass pyClassName pyFlowName pxCreateDateTime |
Rows |
Standard flows, plus flows in your application RuleSets. |
Indexes |
Through multiple indexes, flows can be selected by Applies To class (pyClassName), RuleSet, RuleSet Version, and visible key (pxInsName). |
For example, the pzInsKey value for the property Work-.StandardBasicWork is:
RULE-OBJ-FLOW WORK- STANDARDBASICWORK #20050922T182708.044 GMT
For each flow, the system saves a JPG image of the Process Modeler diagram in a binary file rule (Rule-File-Binary rule type).
The pr4_rule_requirement
table contains application requirements (Rule-Application-Requirement rule type).
Item |
Description |
Database table |
|
pzInsKey elements |
pxObjClass pxInsName pxCreateDateTime |
Rows |
Application requirements. |
Indexes |
Through multiple indexes, requirements can be selected by its class (pxObjClass) and visible key (pxInsName). |
For example, the pzInsKey value for the requirement OrderFW.OrderNumber is:
RULE-APPLICATION-REQUIREMENT ORDERFW ORDERNUMBER #20120328T194203.480 GMT
The pr4_rule_usecase
table contains application specifications (formerly known as use cases) (Rule-Application-UseCase rule type).
Item |
Description |
Database table |
|
pzInsKey elements |
pxObjClass pxInsName pxCreateDateTime |
Rows |
Application specifications |
Indexes |
Through multiple indexes, flows can be selected by its class (pxObjClass) and visible key (pxInsName). |
For example, the pzInsKey value for the use case OrderFW.Purchase.StartPurchase is:
RULE-APPLICATION-USECASE ORDERFW PURCHASE!STARTPURCHASE #20120328T194203.480 GMT
The pr4_fieldvalue
table contains field value rules (Rule-Obj-FieldValue rule type).
Item |
Description |
Database table |
|
pzInsKey elements |
pxObjClass pyClassName pyFlowName pxCreateDateTime |
Rows |
About 5,000 standard field value rules, plus field value rules in your application RuleSets. |
For example, the field value rule Work-.pyStatusWork.New defines a value used in the Local List for the work item status property pyStatusWork. The pzInsKey is:
RULE-OBJ-FIELDVALUE WORK- PYSTATUSWORK!NEW #20040928T000337.867 GMT
Instances of five rule types are stored as rows of the pr4_rule_file
table:
Item |
Description |
Database table | pr4_rule_file
|
pzInsKey elements |
pxObjClass pyClassName pyFileName pyFileType pxCreateDateTime |
Rows |
About 10,000 rows for standard Rule-File- rules, plus other rows for rules in your application RuleSets. |
For example, the binary file rule named webwb.image19.gif holds the Compuserve GIF file used on the standard log-on form. The pzInsKey value for the this rule is:
RULE-FILE-BINARY WEBWB IMAGE19!GIF #20040107T153125.857 GMT
For a binary file rule, the system converts the binary file (such as a JPG image or Windows DLL) to text characters using Base64 coding and stored within the pzPVStream column (Storage Stream, or BLOB). Similarly for an eForm file rule, a PDF file is stored within the pzPVStream column.
Instances of the Rule-Generated-Activity and Rule-System-Generated-Access classes contain system-generated information. These rule instances are stored as rows in the pr4_rule_sysgen
table.
RuleSets (Rule-RuleSet-Name) and RuleSet versions (Rule-RuleSet-Version) are stored in a foundation table, pr4_rule_ruleset
.
Class rules (Rule-Obj-Class) are stored in a foundation table, pr4_base
. See Table and Column Basics.
Shortcut rules and category rules, which support the Report Browser, are stored in the pr4_rule_shortcut
table.
Rules of three rule types supporting the Automated Unit Testing facility (Rule-Autotest-) are stored in the pr4_rule_autotest
table.
By default, rules of types other than those presented above are stored in the pr4_rule
table.
If you create a custom rule type, you can also create a dedicated database table to hold the rules and the associated triggers the table requires. This eliminates the risk that future Pegasystems upgrades to the standard database tables listed above may interfere with the exposed columns and other details needed by the custom rule type. However, this also means that after an upgrade you may need to take extra steps to ensure that your rule table and its associated triggers are correct and up to date. In most cases, it is easier to use an existing rule table and, if necessary, optimize a few extra columns to expose the data your rule type needs.
Rule resolution processing and reporting on rules depends on views and indexes, as well as the tables described here.
Storage Stream, visible key | |
How the system finds rules through rule resolution | |
Initial Database Table data instances |