Apex Aide apexaide

What’s an indexed field?

thegoodenoughconsultant.com· ·Beginner ·Admin ·1 min read
Summary

Indexed fields in Salesforce are specially optimized fields that improve query performance by being stored in an indexed structure. Some fields like lookup, master-detail, audit dates, and system fields are indexed automatically, while custom fields can be indexed by setting them as "External Id" or "Unique", or by requesting Salesforce support. Indexing is key when you frequently query fields as it enhances database speed, but formula fields cannot be indexed. Applying indexing thoughtfully improves Salesforce data retrieval and system efficiency.

Takeaways
  • Indexed fields improve database query performance significantly.
  • Lookup, master-detail, audit dates, and system fields are automatically indexed.
  • Custom fields can be indexed by marking them as External Id or Unique.
  • Formula fields cannot be indexed in Salesforce.
  • Request Salesforce support to index fields not automatically indexed.

In Salesforce, you can group fields into two categories: non-indexed fields 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.

Performance & LimitsData Modeling & GovernanceSalesforce