Find your content:

Search form

You are here

What standard and custom fields are indexed?

 
Share

I'm trying to find a proper list of what standard fields are indexed by default in salesforce, as well as under what conditions custom fields are indexed.

To start things off I know fields are indexed:

  • When salesforce has added a custom index at your request (but you can't rely on this in other orgs)
  • Any fields marked as external IDs
  • Master-Detail fields
  • Lookup fields
  • System audit fields (CreatedDate, SystemModStamp)

I've asked salesforce support and there is no authoritative documentation on this outside of this page: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm


Attribution to: ca_peterson

Possible Suggestion/Solution #1

As of the Spring 15 release of Salesforce, the easiest way to see which fields on a given object are indexed is to check for a "check" in the "Indexed" column in the list of an object's fields in Setup:

Indexed Column in Object Fields list


Attribution to: zachelrath

Possible Suggestion/Solution #2

Just found that salesforce has posted a cheat sheet with much more data about indexing than I've ever seen before. Take a look at the Query & Search Optimization Fields Cheat Sheet on the developerforce wiki's cheat sheet area.

One big takeaway is that there are some substantial differences between performance of standard and custom indexes.

Fields that have standard index applied:

  • Custom lookup fields
  • Custom master-detail fields
  • Id
  • Name
  • Owner
  • Audit dates
  • On standard objects there are some others that aren't documented anywhere

Custom indexes:

  • Can be added by salesforce support
  • External Id fields
  • Unique fields

Attribution to: ca_peterson

Possible Suggestion/Solution #3

From the page you linked

The following fields are indexed by default: primary keys (Id, Name and Owner fields), foreign keys (lookup or master-detail relationship fields), audit dates (such as LastModifiedDate), and custom fields marked as External ID or Unique.

That line answers both the "by default" and "under what conditions custom fields" aspects of your question. That's it.

Update

Some additional information about which fields are automatically indexed and exceptions for those which cannot be indexed is available in the Best Practices for Deployments with Large Data Volumes (PDF) architecture documentation. (In addition to a ton of other great stuff.)

The platform automatically maintains indexes on the following fields for most objects.

  • RecordTypeId
  • Division
  • CreatedDate
  • Systemmodstamp (LastModifiedDate)
  • Name
  • Email (for contacts and leads)
  • Foreign key relationships (lookups and master-detail)
  • The unique Salesforce record ID, which is the primary key for each object

Salesforce also supports custom indexes on custom fields, with the exception of multi-select picklists, text area (long), text area (rich), non-deterministic formula fields, and encrypted text fields.

External IDs cause an index to be created on that field, which is then considered by the Force.com query optimizer.

External IDs can be created on only the following fields.

  • Auto Number
  • Email
  • Number
  • Text

To create custom indexes for other field types, including standard fields, contact salesforce.com Customer Support


Attribution to: David Gillen
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/218

My Block Status

My Block Content