Skip to main content

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to process large SQL resultsets

Suggest edit Updated on September 13, 2021

Summary

A developer asks:

How can our application process huge SQL resultsets?

Is there a way to implement 'cursor-style' processing (iterating through a result set and processing one row at a time) without returning the results to a Page List?



 

Suggested Approach

The recommended approach is to get only a list of keys to the records in the resultset, and then iterate over the keys, opening one record at a time. After the first record is processed, the clipboard pages it occupied can be deleted (or reused for the second record).

In the absence of a key, or a natural combination of values that constitute the equivalent of a primary key, you can use cursor-style processing by writing Java steps. You can use Java steps to declare the cursor, return one row using the cursor, and then using the Java step or a wrapper activity to call the activity on that one row - and then repeat the process. You will need to manage the database connection directly to hold onto it.

In some situations, case match rules may be applicable. Review Rule-Declare-CaseMatch documentation to see whether this rule type is applicable to your problem.

  • Previous topic How to detect and remedy the performance impact of Obj-List methods and list view reports
  • Next topic Implementing serialized objects on distributed systems
Did you find this content helpful? YesNo

0% found this useful

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

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

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us