function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sdusdu 

batch apex order guaranteed or not?

In a batch apex class, if I have an oder by clause in the query locator in start method, is it guaranteed that I would get the records in that order? 
NagendraNagendra (Salesforce Developers) 
Hi,

As batch apex execution is asynchronous you cannot guarantee the order of execution.Batches of records are not guaranteed to execute in the order they are received from the start method.Batches of records tend to execute in the order in which they’re received from the start method. However, the order in which batches of records execute depends on various factors. The order of execution isn’t guaranteed.

For more information may I suggest you please check with below idea which might help you further in understanding better. Hope this helps.

Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra