1

I am running following SOQL and "sometimes" getting server timeout error.

SELECT Id, BccAddress, ParentId, CcAddress, CreatedById, CreatedDate, IsDeleted, ReplyToEmailMessageId, FromAddress, FromName, 
       HasAttachment, Headers, HtmlBody, Incoming, LastModifiedById, LastModifiedDate, MessageDate, Status, Subject, SystemModstamp, TextBody, ToAddress, ActivityId 
    FROM EmailMessage 
    WHERE LASTMODIFIEDDATE  < LAST_N_DAYS:90 limit 100 

Worry is why sometimes it works fine and sometimes it returns server time-out error straight away.

  • Is this the only query in your class? If not then share your code. – Krishna Bidwai Jul 26 '16 at 11:19
  • @krishsfdc Firstly I am having timeout problem even if I am running this query in developer console. Secondly I am using REST based api call for this query. – Fayyaz A Mian Jul 26 '16 at 12:28
  • @AdrianLarson I don't see any field which is not required other than isDeleted and removing that does not solve this. I think problem is with where clause and more specifically "LAST_N_DAYS" – Fayyaz A Mian Jul 26 '16 at 12:33
  • @AdrianLarson I think he mean all the fields are of interest for him except isDeleted. – Krishna Bidwai Jul 26 '16 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.