In Salesforce, you can group fields into two categories:

  1. non-indexed fields
  2. indexed fields

Non-indexed fields are basic fields that are not lookup, master-detail, audit dates, or system fields. For example, Amount on Opportunity is a non-indexed field.

Indexed fields are special fields. Some fields are automatically indexed, such as lookup and master-detail fields, audit dates (like Created Date and Last Modified Date), and system fields (like RecordTypeId).

You can set custom fields as indexed when they aren’t automatically indexed. How? Select “External Id” or “Unique” in their field definition. You can also open a Salesforce case have them index the field.

Why would you want a field to be indexed? Because it significantly improves database performance.

So if you know you’ll be querying these fields, indexing them will guarantee the best possible performance.

Note: Formula fields can never be indexed.

The takeaway
Indexing fields is a great way to improve performance. Use common sense though, as not every fields needs to be indexed.

Category:
Salesforce