You need to sign in to do that
Don't have an account?
Rajesh Raman
SOQL query timeout exception
I am running below menioned SOQL query in my code-
'select Id, Name,BILLINGSTREET, BILLINGCITY,'+ BILLINGSTATE,BILLINGPOSTALCODE,BILLINGCOUNTRY,CORPORATE_MEMBERSHIP_FORCED_LAPSE_DATE__C,'+
'SHIPPINGSTREET,SHIPPINGCITY, SHIPPINGSTATE, SHIPPINGPOSTALCODE, SHIPPINGCOUNTRY, PHONE,FAX,'+ 'ACCOUNTSOURCE, Billing_Country_Code__c,Shipping_Country_Code__c,'+
'(Select Id, MD_Head_of_Household__c, Salutation, firstName, LastName, MailingStreet,MailingCity, MailingState, MailingCountry,' +
'MailingPostalCode,Birthdate,Email,HomePhone,MobilePhone from Contacts) ' +
'from Account where Sync__c = false AND Sync_Timestamp__c >=: startDateTime AND IsDeleted = FALSE order by Sync_Timestamp__c,Id ASC limit '+qLimit+' Offset '+qOffset';
This is query is working fine is TST sandbox but it is giving SOQL query timeout exception in UAT sandbox.
Both sandboxes are Full copy sandboxes and having same data.
Any hep/suggestion would be greatly appreciated.
'select Id, Name,BILLINGSTREET, BILLINGCITY,'+ BILLINGSTATE,BILLINGPOSTALCODE,BILLINGCOUNTRY,CORPORATE_MEMBERSHIP_FORCED_LAPSE_DATE__C,'+
'SHIPPINGSTREET,SHIPPINGCITY, SHIPPINGSTATE, SHIPPINGPOSTALCODE, SHIPPINGCOUNTRY, PHONE,FAX,'+ 'ACCOUNTSOURCE, Billing_Country_Code__c,Shipping_Country_Code__c,'+
'(Select Id, MD_Head_of_Household__c, Salutation, firstName, LastName, MailingStreet,MailingCity, MailingState, MailingCountry,' +
'MailingPostalCode,Birthdate,Email,HomePhone,MobilePhone from Contacts) ' +
'from Account where Sync__c = false AND Sync_Timestamp__c >=: startDateTime AND IsDeleted = FALSE order by Sync_Timestamp__c,Id ASC limit '+qLimit+' Offset '+qOffset';
This is query is working fine is TST sandbox but it is giving SOQL query timeout exception in UAT sandbox.
Both sandboxes are Full copy sandboxes and having same data.
Any hep/suggestion would be greatly appreciated.
Have you tried limiting the no. of records?
Because if you are having a full copy sanbox then it might return a hell lot of records due to which you are hitting standard execution time limit and your process is getting terminated before it could complete.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help.
have you tried StandardSetController ? Because it can increase your limit to some extent and can help you in pagination as well.
FYR -
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_pages_standardsetcontroller.htm