Loading

Salesforce Platform: Deploy Custom Indexes Using Change Sets

Veröffentlichungsdatum: Feb 26, 2026
Beschreibung

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 allow you to bundle components like objects, fields, flows, Apex classes, and more, and deploy them without using external tools.

 

There are three main ways to create indexes:

  • Indexes are automatically created for fields with certain options enabled: If you enable "Unique" or "External ID" for a field's options, an index will be automatically created. (Field types that allow the "External ID" option are: Text, Number, and Email.)
  • Request Salesforce Support to create it: You can ask Salesforce Support to create a single or two-column custom index. If the index is deemed valid and effective by Support, it will be created.
  • Copy existing custom indexes using change sets: You can copy existing custom indexes from a production or Sandbox organization to another organization using change sets.

This article explains more details about "Copy existing custom indexes using change sets".

Copying Existing Custom Indexes Using Change Sets

<Reference> Components Available in Change Sets

  • Custom Index

In an Outbound Change Set, select [Custom Index] (English notation only) from the "Component Type" to add to your Change Set. 

=====
Known Issue: Certain types of Custom Indexes are not available in Change Sets
=====

As of July 2023, as stated in the Known Issue article above, not all custom indexes can be copied using change sets. They fall into three categories: 1) those that do not need to be copied, 2) those that can be copied, and 3) those that cannot be copied.  See the specific examples below.

1) Indexes That Do Not Need to Be Copied

When you enable either the "Unique" or "External ID" option for a field, an index is automatically created. Since these are automatically generated in every organization, there is no need to copy them yourself using change sets.

1st Column2nd ColumnChange Set Copyability
Automatically created

Custom Field

(with "Unique" and/or "External ID" option(s) enabled)

NoneNot Copiable (No need to copy) 


2) Indexes That Can Be Copied Using Change Sets

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

 

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


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 IndexCustom Field (with "Unique" option)Standard FieldCopiable
Two-column Custom IndexCustom Field (with "Unique" option)Custom Field (neither "Unique" nor "External ID" option)Copiable
Two-column Custom IndexCustom Field (with "Unique" option)Custom Field (with "Unique" and/or "External ID" option(s) enabled)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 a custom field, can also be copied via change sets.

Two-column Custom IndexCustom Field (with "External ID" option)Custom Field (neither "Unique" nor "External ID" option)Copiable
Two-column Custom IndexCustom Field (with "External ID" option)Custom Field (with "Unique" and/or "External ID" option(s) enabled)Copiable


3) Indexes That Cannot Be Copied Using Change Sets

In the following cases, these cannot be copied using change sets. If you need these types of indexes created, you will need to request that Salesforce Support create them.

When deploying custom objects or fields with custom indexes from sandbox to production, indexes must be manually recreated as they don't deploy automatically via Change Sets.

When you create an outbound change set, you select the [Custom Index] component and choose the indexes you want to copy from the list of existing index names. However, these non-copiable index types will not appear in that name list.

 

1st Column2nd ColumnChange Set Copyability
Single IndexStandard FieldNoneNot Copiable
Two-column Custom IndexStandard FieldStandard FieldNot Copiable
Two-column Custom IndexStandard FieldCustom Field (neither "Unique" nor "External ID" option)Not Copiable
Two-column Custom IndexStandard FieldCustom Field (with "Unique" and/or "External ID" option(s) enabled)Not Copiable
Two-column Custom IndexCustom Field (with "External ID" option)Standard FieldNot Copiable


Supplement: Copyability Matrix by Field Option

<Single Index>

Single Index

**No need to copy, as indexes are automatically created based on the field option.

<Two-column Custom Index>

Two-column Custom Index

Related Information:

Deploy change sets from sandbox to production

Connect Organizations for Deployment

Nummer des Knowledge-Artikels

000395981

 
Laden
Salesforce Help | Article