I am trying to run a few queries on the Event object.But the queries time out.

Querying the same in Full copy sandbox seems to be okay. But the time out happens in Production only. What could be the possible reasons? I believe, because of the large number of records, the time out is happening. How to look into it?

ERROR: QUERY_TIMEOUT: Your query request was running for too long.


  • 4
    It is usually good idea to post your query... – Artur Kępczyński Jul 17 '14 at 10:39
  • Actually even select count() from event wasn't working. Now its solved after I added isdeleted=true. – MnZ Jul 18 '14 at 11:08

Try running the query using the new query resource feedback parameter in both environments. There may be a difference in the query plan being used based on the volume of data and available indexes.

See Developing Selective Force.com Queries through the Query Resource Feedback Parameter Pilot

There should be an option to access this in the Developer Console with a Summer 14 Org. That won't help you at the moment with production.

Depending on your query, you may need to look at:

  • the types of joins being performed.
  • the where clause operators
  • the number of rows your query will be returning.

SOQL Query Execution Plan

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.