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
Chintan-StringsChintan-Strings 

Maximum Record Size in SELECT (SOQL)

Hello,

 

I am using query("my select statement") function from API to fetch records from Sales Force Account. The Record Count is more but its only giving 2000 records.

Is it the limitation of SOQL SELECT Statement? 

Best Answer chosen by Admin (Salesforce Developers) 
jas12345jas12345

I believe you have to use queryMore() as 2000 is the max batch size according to this section in the doc.

 

Changing the Batch Size in Queries

 

By default, the number of rows returned in the query result object (batch size) returned in a query() or queryMore() call is set to 500. 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.

 

 

All Answers

imuino2imuino2

Actually the of rows youn can retrieve in a single soql query is 10000, and if you reach it without any controll it will break.

So check if there's something on your query thats limiting it to 2000

Chintan-StringsChintan-Strings

There is no condition specified in my SELECT statement neither any other things, its a pure select statement like, select field from Object.

jas12345jas12345

I believe you have to use queryMore() as 2000 is the max batch size according to this section in the doc.

 

Changing the Batch Size in Queries

 

By default, the number of rows returned in the query result object (batch size) returned in a query() or queryMore() call is set to 500. 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.

 

 

This was selected as the best answer