The documentation says that bulk queries' results are limited in size. http://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_concepts_limits.htm

However I can't find any explanation on what happens when this limitation is reached. I suppose the result is simply truncated. Is there a way to be notified when we don't receive all the records matching the query?

The only solution I see is to perform two queries. One with only the Id field and the real query, then compare the number of records returned. This would take quite a long time and consume API calls.

I only want to be informed automatically that I have to split the query.

Thank you

  • don't you get the results in a paged/bulk format?
    – Saariko
    Mar 25, 2013 at 11:32
  • Bulk queries return csv or xml files, and there is a limitation of 10 files of 1 gigabyte each. There is no information regarding how to know if the whole result fitted in the files or if it was truncated.
    – nicolas42
    Apr 9, 2013 at 14:07

1 Answer 1


I suggest you look at how you might be able to use limit class methods to accomplish what you desire.

Several calls that come to mind are: getQueryLocatorRows (Returns the number of records that have been returned by the Database.getQueryLocator method), getQueryRows(Returns the number of records that have been returned by issuing SOQL queries) and getLimitQueryRows(Returns the total number of records that can be returned by issuing SOQL queries).

I'd think that doing a comparison between getLimitQueryRows and getQueryRows (the actual number of lines returned) would tell you what you need to know. How to integrate them into your existing code is of course an entirely different issue. ;)

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.