Bulk Queries

Bulk query jobs enable asynchronous processing of SOQL queries. They are designed to handle queries that return large amounts of data (10,000 records or more).

Availability

Query jobs in Bulk API 2.0 are available in API version 47.0 and later.

Comparison with Query Jobs in Bulk API

Bulk queries are also available in Bulk API. (See Bulk Query.) But the Bulk API 2.0 implementation has several advantages:
  • It does not require you to handle batches. All results are returned from one endpoint.
  • Limits have been simplified and are available to clients via the REST API /limits endpoint.
  • Bulk API 2.0 Query is better integrated with other Salesforce REST APIs.
    • It does not require a special X-SFDC-Session header.
    • It supports all the regular OAuth workflows.
    • Its design is more consistent with the other APIs.

Summary

The following table lists the URIs and methods supported by queries in Bulk API 2.0.

URI HTTP Method Description
/services/data/vXX.X/jobs/query POST

Creates a query job.

/services/data/vXX.X/jobs/query GET

Gets information about all query jobs in the org.

/services/data/vXX.X/jobs/query/queryJobId GET

Gets information about one query job.

/services/data/vXX.X/jobs/query/queryJobId/results GET

Gets the results for a query job.

/services/data/vXX.X/jobs/query/queryJobId PATCH

Aborts a query job.

/services/data/vXX.X/jobs/query/queryJobId DELETE

Deletes a query job.

Limits

Bulk API 2.0 does not support queries with any of the following:
  • GROUP BY, OFFSET, or TYPEOF clauses
  • Aggregate Functions such as COUNT()
  • Date functions in GROUP BY clauses (date functions in WHERE clauses are supported)
  • Compound address fields or compound geolocations fields

The following table lists the limits of query jobs in Bulk API 2.0.

Item Limit
The maximum number of query jobs per 24-hour rolling window).

The current number can be seen in the DailyBulkV2QueryJobs value in the response to the /vXX.X/limits/ REST API method.

10,000
The maximum query result size that can be stored in a 24 hour rolling window.

The current size can be seen in the DailyBulkV2QueryFileStorageMB value in the response to the /vXX.X/limits/ REST API method.

1 TB