I am trying to query Big Object records through Database.getQueryLocator method in a Batch class. However, it is throwing an 'Internal Salesforce Error' on the queryLocator line.

I tried executing queryLocator from Developer Console and again got the 'Internal Salesforce Error'.

Seems like QueryLocator and Big Object don't get along, but I wasn't able to get any sort of documentation for this limitation.

  • This could be per design. Per batch apex documentation, any query that returns more than 50 million records gets terminated. Because Big Object is designed to deal with billion of records, that may be a reason it's not supported in batch apex/query locator. Batch Apex doc link -- developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… – Jayant Das Apr 6 '18 at 13:21
  • How many records are in your big object? – DavidSchach Apr 6 '18 at 16:12
  • I don't suppose you got an error number instead of just the general failure error, did you? – sfdcfox Apr 7 '18 at 3:48
  • @sfdxfox No there was no error number. Just the generic error message – srmaind Apr 7 '18 at 14:30
  • @David, currently there is only one test record in my org – srmaind Apr 7 '18 at 14:32

I have been struggling with the same, here is what I was told:

The QueryLocator approach is not supported for any Virtual Entities that don't return a total size count. This is because BatchApex needs to know the total number of records to create the correct number of jobs.

So you should use Iterator instead (with all its limits).

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.