This page describes best practices for improving performance when you use a
[Salesforce batch
source](https://docs.cloud.google.com/data-fusion/docs/how-to/configure-salesforce-batch-source) in
Cloud Data Fusion.

## Improve performance with PK chunking

PK chunking breaks up large datasets into smaller datasets, or *chunks*.

Enabling PK chunking in the Salesforce batch source plugin has the following
benefits:

- It improves performance, especially for large datasets
- It reduces the load on the server
- It increases scalability

> [!NOTE]
> **Note:** Before enabling PK chunking, check that you're using an sObject that supports it. For more information about PK chunking and the supported sObjects, see the [Salesforce documentation](https://developer.salesforce.com/docs/atlas.en-us.234.0.api_asynch.meta/api_asynch/async_api_headers_enable_pk_chunking.htm).

To use PK chunking, follow these steps:

1. [Go to the Cloud Data Fusion web interface](https://docs.cloud.google.com/data-fusion/docs/create-data-pipeline#navigate-web-interface) and open your pipeline on the **Studio** page.
2. Optional: If you haven't added a Salesforce node in your pipeline, add one:
   1. In the **Source** menu, click **Salesforce** . The Salesforce node appears in your pipeline. If you don't see the Salesforce source on the **Studio** page, [deploy the Salesforce plugins from the Cloud Data Fusion Hub](https://docs.cloud.google.com/data-fusion/docs/how-to/deploy-a-plugin).
3. To configure the source, go to the Salesforce node and click **Properties**.
4. Turn on **Enable PK chunking**.
5. In the **Chunk size** field, enter the number of records per chunk. The default value is `100000` records. The maximum is `250000` records.
6. Click **Validate**.

## Use SObject query filters or SOQL queries

To reduce the number of API calls in Salesforce, retrieve records with SObject
query filters or SOQL queries.

- **SObject query filters** : configure the filter in the Salesforce plugin
  properties in the **SObject name** field. For more information, see
  [Configure the plugin](https://docs.cloud.google.com/data-fusion/docs/how-to/configure-salesforce-batch-source).

- **SOQL queries** : configure the queries in the Salesforce plugin properties
  in the **SOQL query** field. For more information, see [SOQL queries for the
  Salesforce source](https://docs.cloud.google.com/data-fusion/docs/use-case/salesforce-soql-queries).

## What's next

- Learn about configuring the [Salesforce batch source](https://docs.cloud.google.com/data-fusion/docs/how-to/configure-salesforce-batch-source#properties) in Cloud Data Fusion.
- Work through a [Salesforce plugin tutorial](https://docs.cloud.google.com/data-fusion/docs/tutorials/connect-salesforce-to-bq).