Cheatsheet: Fields With Database Indexes
Cheatsheet: Fields With Database Indexes
Cheatsheet
Overview
When building queries, list views, and reports, it's best to create filter conditions that are selective so Force.com scans only the rows necessary in the objects
your queries targetthe Force.com query optimizer doesn't use an index to drive queries containing unselective filter conditions, even if the fields those
filter conditions reference alread have indexes on them. (This cheat sheet's "Index Selectivity Exceptions" section points to several things that automatically
make filter conditions unselective.) Because filter conditions are also unselective if they exceed the Force.com query optimizer's thresholds, selectivity is
especially important when your queries target objects containing more than one million records. Read on to learn how to write selective filter conditions,
minimize your query response times, and optimize the database's overall performance.
RecordType (indexed for all standard objects that feature it) 2 million 300,000 150,000 450,000
Master-detail fields (custom fields are treated as custom indexes 3 million 300,000 300,000 600,000
for index selectivity conditions and thresholds) 4 million 300,000 450,000 750,000
Lookup fields (treated as custom indexes for index selectivity 5 million 300,000 600,000 900,000
conditions and thresholds)
5.6 million 300,000 700,000 1 million
Other Indexed Fields
Unique fields
External ID fields Force.com Query Optimizer Custom Index
Total Records
Be as selective as possible. For example, use Michael*, not Mich*. A Guide to Application Performance Profiling in Force.com (article)
Remember that Chatter feed searches aren't affected by the scope of Best Practices for Deployments with Large Data Volumes (paper)
your search, and that their results include matches across all objects.
Search for exact phrases using advanced searches. Inside the Force.com Query Optimizer (webinar recording)
Fields with Search Indexes (Vary by Object) Force.com Formula Fields, Indexes, and Performance Gotchas
Name fields Force.com SOQL Best Practices: Nulls and Formula Fields
Phone fields
Maximizing the Performance of Force.com SOQL, Reports,
Text fields and List Views
Picklist fields
In the Salesforce Help: help.salesforce.com