function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hexicNexushexicNexus 

Slow search. Using SOQL on an External ID text field, behaves like non-indexed...

I am using a dynamic SOQL search (using "Database.query") in an apex class that i'm using as the controller for a visualforce page. The fields that are searched do not change.

 

When I search for a value that exists in Contact.Name or Account.Name (indexed fields), the results appear in under 3 seconds. However when I search for a value that exists in an External ID text field (which as I understand, should also be indexed), the results take closer to 30 seconds. Subsequent testing has shown that whenever I use non-indexed fields the search time is around 30 seconds.

 

Is there any reason why an External ID text field wouldn't be indexed? Is there any way around it? I am currently looking into using SOSL instead of (or in addition to) SOQL, but have not yet found a sufficient solution.

Santhosh KumarSanthosh Kumar

You should contact Salesforce and ask for help in understanding the performance issue. They would be able to investigate and confirm if that external id field is indexed or not.

hexicNexushexicNexus

Santhosh Kumar wrote:

You should contact Salesforce and ask for help in understanding the performance issue. They would be able to investigate and confirm if that external id field is indexed or not.


I have already contacted Salesforce regarding this issue. However the issue is urgent, and while they research it and get back to me, I am continuing to look for solutions or alternatives. This is still not resolved.