Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

QueryOptions

Specifies the preferred batch size for queries. The system sometimes creates batches that are larger or smaller than the specified size to maximize performance.

Associated API Calls

query(), queryMore(), retrieve()

Fields

Element Name Type Description
batchSize int

The batch size for the number of records returned in a query() or queryMore() call. Child objects count toward the number of records for the batch size. For example, in relationship queries, multiple child objects are returned per parent row returned.

The default and the maximum are 2,000; the minimum is 200. There is no guarantee that the requested batch size is the actual batch size. To maximize performance, the number of results returned can vary based on the size and complexity of the records..

Sample Code

For code examples, see Change the Batch Size in Queries in the Salesforce SOQL and SOSL Reference Guide.