What standard and custom fields are indexed?

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


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


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

Tags:

Soql