0

We're executing a query:

SELECT Id, SomeField FROM SomeTable

We have over 80,000 items in SomeTable but only 2000 items are ever returned

SELECT Id, SomeField FROM SomeTable LIMIT 100000

does nothing to fix the problem.

What is the optimal way to overcome this limit? Using a for loop? What would be the syntax if using the PHP REST API?

Brooks
  • 2,082
  • 2
  • 18
  • 26

1 Answers1

0

You can use SOQL For loops to manage this. According to the documentation:

SOQL for loops retrieve all sObjects, using efficient chunking with calls to the query and queryMore methods of the SOAP API. Developers should always use a SOQL for loop to process query results that return many records, to avoid the limit on heap size.

Hope this helps!

Anup

Community
  • 1
  • 1
Anup
  • 951
  • 2
  • 10
  • 25
  • Brilliant. Do you happen to know the syntax for building and returning an array to the php client? – Brooks Jul 30 '12 at 15:06
  • The link in my answer has a good example to demonstrate this. – Anup Jul 31 '12 at 11:51
  • Looking at your link, unless I'm missing something (which is likely), I'm not seeing anything about how the return array is specified. Nor am I seeing whether or not the for loop has to modify the query OFFSET or if it is just sufficient to just say 'SELECT fieldList FROM objectType'. If you don't mind providang a simple example, it would be much appreciated and I'm sure would save myself (and future readers) considerable Salesforce documentation faffery. Thanks. – Brooks Jul 31 '12 at 15:28