You need to sign in to do that
Don't have an account?
Ken Koellner @ Engageware
Index used in SOQL query with leading % in Like showplan
There are a number of resources that state that SOQL queries will not use an index when the LIKE operator is used if the value includes a leading "%" (some resources simply say contains "%").
I tried it and it appears to be indexing. See the example below. I'm using the value "%inc.com%" on the Contact.email field and it is indexed.
Does anyone knows where UP-TO-DATE documentation is on when SOQL indexes? Many blogs are out of date.
14:38:44.0 (2411702)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|SELECT Id FROM Contact WHERE email LIKE '%inc.com%' 14:38:44.0 (51660495)|SOQL_EXECUTE_EXPLAIN|[1]|Index on Contact : [Email], cardinality: 166, sobjectCardinality: 132480, relativeCost 0.071 14:38:44.0 (51677498)|SOQL_EXECUTE_END|[1]|Rows:199
These two articles are Salesforce help articles, which might be useful to you.
Please refer to the below links.
Please mark it as Best Answer if the above information was helpful.
Thanks.