Newer Version Available

This content describes an older version of this product. View Latest

Change the Batch Size in Queries

You can change the batch size (the number of rows that are returned in the query result object) that’s returned in a query() or queryMore() call from the default 500 rows.

WSC clients can set the batch size by calling setQueryOptions() on the connection object. C# client applications can change this setting by specifying the batch size in the call QueryOptions portion of the SOAP header before invoking the query() call. The maximum batch size is 2,000 records. However this setting is only a suggestion. There is no guarantee that the requested batch size will be the actual batch size. This is done to maximize performance.

The batch size will be no more than 200 if the SOQL statement selects two or more custom fields of type long text. This is to prevent large SOAP messages from being returned.

Note

The following sample Java (WSC) code demonstrates setting the batch size to two hundred and fifty (250) records.

The following sample C# (.NET) code demonstrates setting the batch size to two hundred and fifty (250) records.