AdvancedLesson 34 of 37
Performance and large data volumes
Keep things fast as data grows.
- Write selective SOQL: filter on indexed fields (Id, Name, lookup/master-detail, External ID, unique fields, audit dates). Non-selective queries on large tables time out.
- Avoid
LIKE '%text'and negative filters (!=,NOT IN) on big objects. - Skinny tables, custom indexes (via Support) and Big Objects help at scale.
- Use Batch Apex or Bulk API for large loads; defer sharing calculations.
- Avoid data skew: tens of thousands of children under one parent, or one owner, cause locking.
- Cache with Platform Cache; avoid redundant queries with Maps.