# Which fields are indexed by default in Salesforce, and what makes a SOQL filter non-selective (e.g., !=, NOT LIKE '%abc', leading wildcards, formula fields)?

**Topic:** Soql · **Difficulty:** Hard · **Asked at:** Salesforce, Deloitte, Persistent · **Tags:** soql, performance, selectivity, indexes

Read it on the site: https://www.forcechallenges.com/interview-questions/which-fields-are-indexed-by-default-in-salesforce-and-what-makes-a-soql-filter-non-selective-e-g-not-like-abc

## Answer

**Indexed by default:** Id, Name, OwnerId, CreatedDate, SystemModstamp, RecordTypeId, lookup and master-detail fields, unique fields, external Id fields (and fields with a custom index requested from Support).

**Things that make a filter non-selective:**
- Negative operators: `!=`, `NOT IN`, `NOT LIKE`, `EXCLUDES`
- Leading wildcards: `LIKE '%abc'`
- Filtering on null: `Field = null` (often)
- Formula fields (non-deterministic/unindexed) and fields wrapped in functions
- Filters returning more than the threshold of rows

Fix by adding indexed filters, requesting custom indexes, using skinny tables, or restructuring the query.

---
Source: ForceChallenges · last updated 2026-10-21
