Loading

Purge AsyncApexJob to delete already executed asynchronous Apex job records

Дата публикации: Dec 11, 2025
Описание

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. 
 

Решение
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.
Номер статьи базы знаний

000383655

 
Загрузка
Salesforce Help | Article