-2

I need to query more than 50000 records and store it in a List variable. i know there is a governor limit which prevents it. please let me know if this can be accomplished without going for a batch class.

will getQueryLocator work in a normal class... please help.

  • What you have tried so far? – rahul gawale Apr 29 at 9:59
  • Why do you need more than 50,000 rows? What are you attempting to do? – sfdcfox Apr 29 at 11:28
3

Since Simmer '18, The SOQL Count() Function Doesn’t Count (As Much) Toward Limits so you can count way more than 50,000 records.

If you are working from a Visaulforce page, setting readOnly="true" lifts the limit to 1,000,000 rows (see e.g. Setting Read-Only Mode for an Entire Page) but other limits such as the heap size still apply.

But the general solution when wanting to work with large numbers of rows is to move to asynchronous Apex such as batchable where QueryLocator can be used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.