Loading
Scalability
ApexGuru Antipattern: SOQL with Wildcard Filter

ApexGuru Antipattern: SOQL with Wildcard Filter

Using a wildcard such as LIKE '%term in SOQL queries prevents the use of indexes and causes full-table scans. Full-table scans increase query execution time and CPU usage. Use indexed fields for filtering and optimized search strategies.

Scope

Detection only

Detection Example

apex
SELECT Id, LastName, FirstName FROM Contact WHERE LastName LIKE '%smi'
 
Indlæser
Salesforce Help | Article