When a SOQL query has both a LIMIT clause and a Sforce-Query-Options: batchSize with different but valid values, which one of these gets a higher precedence?

  1. A query with only LIMIT clause
SELECT ID from foo__c LIMIT 1000
  1. Another query with a LIMIT clause and the Sforce-Query-Options: batchSize header i.e.
Sforce-Query-Options: batchSize=250

SELECT ID from foo__c LIMIT 1000

The second query with a batchSize=250 header and limit clause of 1000 only returns 250 records.

Does it mean batchSize header has a higher precedence over the LIMIT clause?

1 Answer 1


batchSize only affects the number of records returned per API call. To get the rest, follow the nextRecordsUrl parameter. Note that batchSize is only a hint. Actual batch size may be smaller depending on how many, and what type, of fields are requested. In any event, the maximum batch size is 2000, while max limit is 50 million.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .