You need to sign in to do that
Don't have an account?
Antoine LELEU 10
SOQL unusually long during Trigger Execution
Hello,
I identified a SOQL request unusually long during an Execution Trigger :
17:53:37.3 (894756684)|SOQL_EXECUTE_BEGIN|[13]|Aggregations:0|SELECT Id, AccountId, StartDate, Date_de_fin__c, CONTRAT_EN_COURS_form__c FROM Contract WHERE (CONTRAT_EN_COURS_form__c = TRUE AND AccountId IN :tmpVar1) LIMIT 50000 17:53:50.852 (13852270691)|SOQL_EXECUTE_END|[13]|Rows:0
I don't understand why this request is so long, about 13s.
For information, there is no Contract record in the org. All the contract are deleted each night.
Any ideas ?
Thank for your help.
Antoine
I identified a SOQL request unusually long during an Execution Trigger :
17:53:37.3 (894756684)|SOQL_EXECUTE_BEGIN|[13]|Aggregations:0|SELECT Id, AccountId, StartDate, Date_de_fin__c, CONTRAT_EN_COURS_form__c FROM Contract WHERE (CONTRAT_EN_COURS_form__c = TRUE AND AccountId IN :tmpVar1) LIMIT 50000 17:53:50.852 (13852270691)|SOQL_EXECUTE_END|[13]|Rows:0
I don't understand why this request is so long, about 13s.
For information, there is no Contract record in the org. All the contract are deleted each night.
Any ideas ?
Thank for your help.
Antoine
1) http://help.salesforce.com/apex/HTViewSolution?id=000181277&language=en_US
2) https://help.salesforce.com/apex/HTViewSolution?urlname=Force-com-Query-Optimizer-FAQ
NOTE:- In operator will also include the solf deleted record , That is , deleted record that are still in th Recycle BIN
For best performance, SOQL queries must be selective, particularly for queries inside of triggers. To avoid long execution times, the system can terminate nonselective SOQL queries Please check below post for more information.
1) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_VLSQ.htm
2) https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-make-my-SOQL-query-selective&language=en_US
3) https://developer.salesforce.com/page/Developing_Selective_Force.com_Queries_through_the_Query_Resource_Feedback_Parameter_Pilot
Let us know if this will help you
Thanks
Amit Chaudhary
All Answers
thanks for your answer, i know this but as explained :
For information, there is no Contract record in the org. All the contract are deleted each night.
Antoine
1) http://help.salesforce.com/apex/HTViewSolution?id=000181277&language=en_US
2) https://help.salesforce.com/apex/HTViewSolution?urlname=Force-com-Query-Optimizer-FAQ
NOTE:- In operator will also include the solf deleted record , That is , deleted record that are still in th Recycle BIN
For best performance, SOQL queries must be selective, particularly for queries inside of triggers. To avoid long execution times, the system can terminate nonselective SOQL queries Please check below post for more information.
1) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_VLSQ.htm
2) https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-make-my-SOQL-query-selective&language=en_US
3) https://developer.salesforce.com/page/Developing_Selective_Force.com_Queries_through_the_Query_Resource_Feedback_Parameter_Pilot
Let us know if this will help you
Thanks
Amit Chaudhary
your informations are very helpfull.
Do you know what is the best way to exclude deleted records from soql query ?
Thanks a lot,
Antoine
1) https://success.salesforce.com/ideaView?id=08730000000iXJ1AAM
There is an IsDeleted system field (checkbox for TRUE/FALSE) on the records. You can include IsDeleted=FALSE in your query.
But that will still search record in deleted record as well.
http://www.salesforcegeneral.com/salesforce-articles/including-archived-and-deleted-records-in-your-soql-query.html
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm
Sorry no solution for same now. Simply detele all record from recycle bin also
Let us know if this will help you
Antoine