vaishali231
Kilo Sage

hey @gangaram_ka 

handling archived data properly is important to avoid unexpected performance issues.
Best practices for retrieving archived records
Archived records are stored in separate tables (e.g., ar_incident, ar_case), so you’ll need to query those tables directly.

Always use well-defined filters (especially on date fields like sys_created_on or sys_archived) to avoid full table scans.

Limit the number of fields returned and avoid unnecessary data processing.

 

For repeated use cases, consider creating a dedicated module or report instead of ad-hoc queries.

 

Performance considerations
Accessing archive tables does not directly impact active table performance, since they are stored separately.

However, archive tables can be very large, so:

Unfiltered queries can lead to slow execution

Large reports may consume node resources

Avoid using archive data in real-time transactions (forms, client scripts, portals, VA).

 

Recommended approaches
1. Scheduled Jobs (Preferred for large data)
Run during off-peak hours

Fetch only required records

Store results in a staging table or export if needed


2. Reporting on archive tables
Suitable for audit or occasional access

Ensure filters (e.g., older than 1 year) are applied


3. Background / Fix scripts
Good for one-time data retrieval or analysis

Test in sub-prod due to potential volume impact

 

Things to avoid
Querying archive tables in synchronous flows or user-facing transactions

Running unfiltered GlideRecord queries on ar_* tables

Mixing active and archived data in a single real-time query

 

Additional recommendations
Verify indexing on commonly queried fields (especially date columns)

Use GlideAggregate for counts instead of looping through records

Align with your data retention and archiving strategy before querying


*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh