You need to sign in to do that
Don't have an account?
Same SOQL Query taking a long time in a “VF page controller” VS in the “Developer Console”
Simple query, taking 1 minute in the VF page controller, and less than 1 second when executed in the Developer Console. There are more than 50,000 records that the query is searching through. Why such a dramatic difference in the query run time?
String s = '123456'; List<Registration__c> regs = [select id, name from Registration__c where name =: s or speical_number__c =: s limit 1];
Here are the excerpts from the debug logs:
Developer Console:
12:22:39.063 (63557000)|SOQL_EXECUTE_BEGIN|[2]|Aggregations:0|select id, name from Registration__c where (name = :tmpVar1 or speical_number__c = :tmpVar2) limit 1
12:22:39.263 (263582000)|SOQL_EXECUTE_END|[2]|Rows:0
VF Page Controller:
12:17:08.148 (3148592000)|SOQL_EXECUTE_BEGIN|[633]|Aggregations:0|select id, name from Registration__c where (name = :tmpVar1 or speical_number__c = :tmpVar2) limit 1
12:18:07.350 (62350264000)|SOQL_EXECUTE_END|[633]|Rows:0
That's curious. Couple questions.
- Is this consistantly reproducible?
- Does it matter the order? i.e. VF then DC or DC than VF.
- Is VF tracing on in your log levels?
- I'm assuming you are running the query as an Sys Admin with view all data?
It's not consistently reproducible, but when it happens, the delay is always on the same query.
I can't check if the order matters b/c of inconsistency of the issue. (I'm guessing it might be going over the prefetched results in subsequent runs?)
VF logging is set to INFO, which includes "VF_SERIALIZE_VIEWSTATE_BEGIN; VF_SERIALIZE_VIEWSTATE_END; VF_DESERIALIZE_VIEWSTATE_BEGIN; VF_DESERIALIZE_VIEWSTATE_END;"
Running the query as Sys Admin with View All.
Just check that may be...