3 个回答
HI Gopi,As per documentation , "A maximum of 50 million records can be returned in the Database.QueryLocator object. If more than 50 million records are returned, the batch job is immediately terminated and marked as Failed."What is your usecase of having to process 50 million records ? You should make sure your queries are tuned properly to run as quickly and efficiently as possible.I would recommend working on the SOQL query to make it more selective so that it returns less than 50 million records for you to be able to use in a batch apex.Please see the below articles for tuning your SOQL query.Working With Very Large SOQL Querieshttps://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_VLSQ.htmMake SOQL Query Selectivehttps://help.salesforce.com/s/articleView?id=000325257&type=1Also, if processing the records synchronously is not a strict requirement, consider using asynchronous processing options like Queueable Apex or Future Methods. These allow you to offload processing to separate execution contexts, providing more flexibility in handling large data volumes.You can also consider using Bulk API(PK Chunking) https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/async_api_headers_enable_pk_chunking.htmIf this information helps, please mark the answer as best. Thank you