Loading

Purge AsyncApexJob to delete already executed asynchronous Apex job records

Fecha de publicación: Dec 11, 2025
Descripción

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. 
 

Solución
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.
Número del artículo de conocimiento

000383655

 
Cargando
Salesforce Help | Article