+ Start a Discussion
John SaundersJohn Saunders 

Query Timeout vs. Network Timeout

I just ran a query (using sforce Explorer .NET version) for "select Id from AccountShare". This was for a large customer with nearly 2 million AccountShare records.

I did not receive a query timeout. I received a network timeout. I also tried the same thing with the API and confirmed that it is a network timeout by increasing the Timeout in the web service binding.

Is this the expected behavior? Under which circumstances should I expect a query timeout vs. a network timeout?

The default timeout in most SOAP stacks is shorted than the query timeout (the query timeout is 2 mins, while axis's default timeout is 60 seconds, and .NET is 100 seconds). If you bump up your soap stack timeout setting, you should see a query timeout.
John SaundersJohn Saunders


I did increase the timeout to 5 minutes, and I did _not_ see the query timeout.

The 2-minute timeout is 5.0 and up only.

At what time are you seeing the network timeout?

You probably only need all the accountshare rows that are manual shares. If you are trying to backup your data, all the other rows (child implicit, parent implicit, rule shares) would be automatically created based on the role hierarchy and sharing rules.
Could you please tell me how to set the default timeout from 2 mins to 5 mins. where should i increase this timeout settings either in configuration or code?
I am frequently  getting the following exception while extrating the data from salesforce.
com.bea.control.ServiceControlException: <xml-fragment xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><faultcode>sf:QUERY_TIMEOUT</faultcode><faultstring>QUERY_TIMEOUT: Your query request was running for too long.</faultstring><detail><sf:fault xsi:type="sf:UnexpectedErrorFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com"><sf:exceptionCode xmlns:sf="urn:fault.enterprise.soap.sforce.com">QUERY_TIMEOUT</sf:exceptionCode><sf:exceptionMessage xmlns:sf="urn:fault.enterprise.soap.sforce.com">Your query request was running for too long.</sf:exceptionMessage></sf:fault></detail></xml-fragment>

Please help me understand how to avoid this query time out error permanently. I've already enhanced the query with the batch size set as 250.

Hi John,

I am facing the query timeout problem and while doing some research on this came to know you had faced the same problem and you increased the query timeout to 5 minutes.Could you please let me know how to increase the query timeout value.

It would be great help.