Loading

Salesforce Platform: Deploy Custom Indexes Using Change Sets

Data pubblicazione: Feb 26, 2026
Descrizione

Custom indexes are database indexes created on custom fields in Salesforce to improve query performance, especially when working with large data volumes. By indexing a field, Salesforce can retrieve records more efficiently when that field is used in filters, such as in SOQL queries, reports, or list views, reducing query time and avoiding performance issues.

Change sets are a Salesforce deployment tool used to move configuration (metadata) from one org to another, typically from a sandbox to a production environment. They let you bundle components like objects, fields, flows, Apex classes, and custom indexes, and deploy them without external tools. This article explains which custom indexes can, and cannot, be deployed with a change set.

Risoluzione

This article explains which custom indexes can be copied between Salesforce orgs using change sets, and which cannot, so you know when to use a change set versus asking Salesforce Support to create an index directly.

Custom Indexes

Custom indexes are database indexes created on custom fields in Salesforce to improve query performance, especially when working with large data volumes. By indexing a field, Salesforce can retrieve records more efficiently when that field is used in filters, such as in SOQL queries, reports, or list views, reducing query time and avoiding performance issues.

Change Sets

Change sets are a Salesforce deployment tool used to move configuration (metadata) from one org to another, typically from a sandbox to a production environment. They let you bundle components like objects, fields, flows, Apex classes, and custom indexes, and deploy them without external tools.

Three Ways to Create a Custom Index

  • Automatic creation: If you enable "Unique" or "External ID" for a field's options, Salesforce automatically creates an index. Field types that support "External ID" are Text, Number, and Email.
  • Request Salesforce Support: You can ask Salesforce Support to create a single or two-column custom index. If Support determines the index is valid and effective, they will create it.
  • Copy using change sets: You can copy existing custom indexes from a production or sandbox org to another org using change sets. The rest of this article covers this method in detail.

Copying Existing Custom Indexes Using Change Sets

In an outbound change set, select "Custom Index" (English org language only) from the Component Type picklist to add existing indexes to your change set. See Components Available in Change Sets for background on change set components.

As of July 2023, not every custom index can be copied using change sets. Custom indexes fall into three categories: those that do not need to be copied, those that can be copied, and those that cannot be copied. Each is explained below with examples. See also the known issue: Certain types of Custom Indexes are not available in Change Sets.

Indexes That Do Not Need to Be Copied

When you enable either the "Unique" or "External ID" option for a field, Salesforce automatically creates an index for it. Since these indexes are generated automatically in every org, you do not need to copy them with a change set.

1st Column2nd ColumnChange Set Copyability
Custom Field (with "Unique" and/or "External ID" option enabled), automatically createdNoneNot copiable (no need to copy)

Indexes That Can Be Copied Using Change Sets

A single index on a custom field with neither "Unique" nor "External ID" enabled can be copied via change sets. A two-column custom index where the first column is a custom field with neither option enabled can also be copied, regardless of the second column's type.

1st Column2nd ColumnChange Set Copyability
Single Index: Custom Field (neither "Unique" nor "External ID")NoneCopiable
Two-column: Custom Field (neither "Unique" nor "External ID")Standard FieldCopiable
Two-column: Custom Field (neither "Unique" nor "External ID")Custom Field (neither "Unique" nor "External ID")Copiable
Two-column: Custom Field (neither "Unique" nor "External ID")Custom Field (with "Unique" and/or "External ID")Copiable

![Single-index copyability matrix: custom fields without Unique or External ID enabled are copiable via change sets](/servlet/rtaImage?eid=ka0Hx000002QDBl&feoid=00NHx00000005DB&refid=0EMHx00000TGNcf)

A two-column custom index where the first column is a custom field with only the "Unique" option enabled can also be copied via change sets, regardless of the second column's type.

1st Column2nd ColumnChange Set Copyability
Two-column: Custom Field (with "Unique" option)Standard FieldCopiable
Two-column: Custom Field (with "Unique" option)Custom Field (neither "Unique" nor "External ID")Copiable
Two-column: Custom Field (with "Unique" option)Custom Field (with "Unique" and/or "External ID")Copiable

A two-column custom index where the first column is a custom field with the "External ID" option enabled and the second column is also a custom field can be copied via change sets.

1st Column2nd ColumnChange Set Copyability
Two-column: Custom Field (with "External ID" option)Custom Field (neither "Unique" nor "External ID")Copiable
Two-column: Custom Field (with "External ID" option)Custom Field (with "Unique" and/or "External ID")Copiable

![Two-column custom index copyability matrix by first and second column field type](/servlet/rtaImage?eid=ka0Hx000002QDBl&feoid=00NHx00000005DB&refid=0EMHx00000TGNrB)

Indexes That Cannot Be Copied Using Change Sets

The following index types cannot be copied using change sets. If you need one of these created, request it from Salesforce Support instead. When deploying custom objects or fields with custom indexes from sandbox to production, these indexes must be manually recreated, since they don't deploy automatically via change sets. When you create an outbound change set and select the "Custom Index" component, these non-copiable index types won't appear in the list of existing index names to choose from.

1st Column2nd ColumnChange Set Copyability
Single Index: Standard FieldNoneNot copiable
Two-column: Standard FieldStandard FieldNot copiable
Two-column: Standard FieldCustom Field (neither "Unique" nor "External ID")Not copiable
Two-column: Standard FieldCustom Field (with "Unique" and/or "External ID")Not copiable
Two-column: Custom Field (with "External ID" option)Standard FieldNot copiable
Numero articolo Knowledge

000395981

 
Caricamento
Salesforce Help | Article