Skip to main content

Data storage in Pega

Pega Platform™ saves data across multiple database tables when a Case is processed. The system uses Pega Platform classes to organize and store the data in the appropriate table. When you create reports, the Pega Platform reporting tool uses the Pega Platform class organization to find and retrieve information from these tables. Efficient data organization and access enables the organization to generate reports that support key strategic decisions.

The following figure displays the mapping between classes and database tables in an HR application:

Database Class Mappings tab
Note: Access the Database Class Mappings landing page by navigating to Configure > Data Model > Classes & Properties > Database Class Mappings.

For example, managers want to know which customer service representatives (CSRs) resolved the most Cases during the past three quarters. The report requires you to combine Case information and historical processing information. This information may be stored in separate tables.

The following video highlights how Pega Platform's flexible Data Model helps generate information immediately to suit reporting requirements:

Video transcript

The great value in reporting comes with the inherent challenge that an organization often does not know what future reports will be needed at design time. A flexible Data Model allows for on-demand transparency of the data. However, even if your Data Model does not directly support your current reporting needs, your reporting tool must still be able to quickly retrieve information from multiple locations. This allows the business to make key strategic decisions at the ideal moment. Without a flexible Data Model, the data cannot be retrieved and presented effectively.

A Chief Marketing Officer (CMO) wants to see the total sales of a single product line for customers aged 18-35, grouped by gender and region. Our robust reporting tool can accommodate most Data Models to handle this complex query and immediately return a comprehensive result for the CMO.

Class mappings and database tables

Any Pega Platform class with concrete instances, such as Case Types, is mapped to a database table. For example, when users create Cases, the system assigns an ID to the Case and saves the value as an individual row in a database table. When you generate reports, you retrieve data from rows in database tables. Reports use class mappings to locate the data from one or more database tables. For example, when a user creates a Case, Pega Platform assigns a unique Case ID by using the class mapping to save the instance as a row in the correct database table. Similarly, when accessing a class instance, for example, opening a Case or running a report, Pega Platform uses the class mapping to retrieve data from the associated database table.

Note: Classes can be concrete or abstract. You can create instances of concrete classes, while you cannot create instances of abstract classes. You typically use abstract classes to store reusable Rules that apply to many concrete classes. For more information about concrete and abstract classes, see Best practices for Data Models.
Caution: For performance reasons, only fetch the required columns from the database. Avoid fetching all columns from the database if you do not need data from all columns for your report.

When designing reports, you need to know which table has the data and how the data is mapped. For example, you may need to create a report that contains information about Candidate Cases. These records are instances in the Case Work- class. In the same report, you may also want to include Work Queue information about each Candidate Case. Work Queue records are instances in a workbasket class. The data for each type of information is stored in separate tables. When you combine the data in a report, you use class names to identify the tables where the information is stored.

Class Mapping
Note: To align with industry terminology, Pega Platform now uses the term Work Queue in place of workbasket in Assignment routing. The class structure still uses the workbasket name: Data-Admin-Workbasket.

Records used for mapping classes to tables

Pega Platform uses two Rule Types to identify the database table the class is mapped to: Database and Database Table.

  • Database records identify how Pega Platform connects to specific databases and contains the connection information for Pega Platform to access the databases. This record is an alias that can be referenced elsewhere, such as in a Database Table record. Database records can be configured to use either JNDI or JDBC URL for the database connection. By default, Pega Platform always contains the following database records:
    • PegaRULES – Maps to the database where all Pega Platform Rules and system data are saved.

    • PegaDATA  Maps to the database where data and work instances are saved.

  • Database Table records exist for every concrete class. A class mapping (Data-Admin-DB-Table-Rule) associates the concrete class with a database table. Pega Platform uses this record to identify which table to write Case data when a user creates or updates a Case or data instance.

Multiple-class mapping to a single table

In some situations, you may want to save instances of several classes in the same table. For example, in an application with three Case Types, Candidate (class TGB-HR-Apps-Work-Candidate), Onboarding (class TGB-HR-Apps-Work-Onboarding), and Benefits Enrollment (class TGB-HR-Apps-Work-BenefitsEnrollment), you need to report on the work status of all Cases in the application.

Rather than create a database table for each Case Type, you designate a class, usually the parent class (TGB-HR-Apps-Work), as a class group (also referred to as a work pool). Class groups cause the system to store instances of similar or related Case Types together in a single database table. A report created in a specific Case Type, such as Candidate, returns only records in the Case Type. A report created in the class group returns all instances in the classes that belong to the class group.

Note: In Dev Studio, class mappings are displayed in the Database Class Mappings landing page Configure > Data Model > Classes & Properties > Database Class Mappings.

The following example shows the work classes that map to the class group database table pc_TGB_HRApps_Work.

Database table example

Check your knowledge with the following interaction:

Commonly used reporting classes and properties

You commonly generate reports that include properties from three different classes: work, Assignment, and history. Each type of report uses properties from classes that are mapped to different database tables.

Work reports

When a Case is created, the properties from the work class and the inherited classes (pattern and directed) are used to generate reports. Some commonly used properties are:

  • pyID – Case Identifier
  • pyWorkParty – Work parties participating
  • pxUpdateOperator – Last user to update the Case
  • pxUpdateDateTime – Time of the last update
  • pyStatusWork – Work status of the Case

Work reports are created in the appropriate work class (such as TGB-HRApp-Work) and the class mapping specifies which database table is used to source the required data. To optimize performance, properties referenced in reports must be exposed as columns in the database table. To determine if a column is exposed, use the Database Class Mappings landing page, and then click the Columns value for the class to show all the columns in the table.

Note: For more information about property optimization, see Optimizing properties from the user interface.

Assignment reports

Assignments are created during a Case Life Cycle, typically where some form of user interaction is required. The two main types of Assignment objects created are Worklist (class Assign-Worklist) and workbasket (class Assign-WorkBasket), which are mapped to the database tables pc_assign_worklist and pc_assign_workbasket respectively by using the associated class mappings. When an Assignment is completed, the Assignment object is deleted and another is created following the processing in the steps and stages of a case type.

Assignment reports are displayed on a user's Portal to list Assignments in their Worklist and any Work Queues to which they have access. There are many standard Assignment reports (such as pyAssignmentWorklist), and these reports are often specialized to meet specific business requirements (for example, a join to the class of a Case Type to return associated Case data). When joining to the class of a Case Type, the Assignment class pxRefObjectKey is used to match with the pzInsKey of the Case Type.

History reports

You can use properties in history classes to create performance reports. For example, the property pxTaskElapsedTime saves the total time spent on an Assignment. If an Assignment is routed to multiple users, the property pyPerformTaskTime records the total time spent by all users on that Assignment. If pyPerformTaskTime is significantly lower than pxTaskElapsedTime, that value indicates the Assignment has been idle for a long time.

Note: For more information about using the statistics for performance reports, see Performance statistics.

In the following image, click the + icons to review the three common types of class mappings:

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice