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
admin dudeadmin dude 

SOQL order by ID

When sending a request to REST API queryAll endpoint with a query that contains 'order by ID' is it guaranteed that the ids are given to objects in imcremental order? for example, let's say I send the query 'select logFile from EventLogFile order by id' and i receive 4 ordered objects by ids [<logfile1>,<logfile2>,<logfile3>,<logfile4>]. after 1 hour I send the same query and now I receive 5 ordered objects by ids. is it guaranteed that the order is [<logfile1>,<logfile2>,<logfile3>,<logfile4>,<logfile5>] or is it possible that [<logfile1>,<logfile2>,<logfile5>,<logfile3>,<logfile4>]?
SwethaSwetha (Salesforce Developers) 
HI Admin,

Based on https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_orderby.htm, if you do not specify the order by as ASC or Desc, the default order is ascending. 

And even if you use ORDER BY, the order of results can vary if there are duplicate values for the fields you’re using in the ORDER BY clause. 

Related: https://salesforce.stackexchange.com/questions/269501/soql-get-results-in-same-order-as-in-query
https://salesforce.stackexchange.com/questions/7667/soql-result-ordering-in-the-absence-of-an-order-by-clause

If this information helps, please mark the answer as best. Thank you