Loading
Feature Disruption - Service Cloud VoiceRead More
Feature degradation | Gmail Email delivery failureRead More

Purge AsyncApexJob to delete already executed asynchronous Apex job records

Publish Date: Dec 11, 2025
Description

Queries against AsyncApexJob may receive this message:
System.QueryException: Non-selective query against large object type (more than 100, 000 rows). Consider an indexed filter or contact Salesforce about custom indexing. 
 

Resolution
Salesforce automatically purges completed AsyncApexJob records after 7 days. If the number of records grows above 100,000, consider implementing purgeOldAsyncJobs(Date).
 
In API version 66.0 and later, you can use the method overload purgeOldAsyncJobs(Date, numOfJobs) to specify the maximum number of oldest, completed async jobs in your org to be purged. Providing an upper bound for the number of records to be deleted allows incremental progress when you have to delete large volumes of records.
Knowledge Article Number

000383655

 
Loading
Salesforce Help | Article