I am required to retrieve all the records (including archived and deleted records) from a Salesforce object. I understand that this can be achieved using queryAll(). However, I have an environment that has records in millions (>50M) and would prefer to query using Bulk API. I am thinking of submitting a faster approach to retrieve the data by:

  1. Querying the records (which do not contain the deleted and archived records) using Bulk API
  2. Individually query the rest.

Step 2 seems to be harder to specifically retrieve using Bulk API. If I'm not wrong, this can be achieved only by queryAll() and not by Bulk API. My understanding is that in order to retrieve the archived/deleted data is by the filter:


Is there a better way to query only the deleted and archived records taking the query load into considerations?

  • Bulk API v1 does support queryAll. You can still use it to query the data you want. It's still limited to 50,000,000 rows per transaction, if I recall, but will save considerable number of API calls.
    – sfdcfox
    Sep 18, 2018 at 21:51
  • @sfdcfox Looked at the latest documentation. Apparently, the newest update has this on Bulk API. Older versions (using v37) didn't have this one. Also, tested on workbench (v43) still had an issue of "Including deleted and archived records not supported by Bulk Queries." Developing using API did work though!
    – dmachop
    Sep 21, 2018 at 21:31


Your Answer

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

Browse other questions tagged or ask your own question.