function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PannarPannar 

how to avoid SFDC Query time out exception

Hi,
 
I am querying contact object from salesforce thru java code. it might return 1lak records, so it is failing and shown the below exception and not fetched any records. it got stucked and doesn't return even a single record.
 

####<Dec 14, 2008 3:15:22 PM EST> <Warning> <WLW> <tfsny395sql> <cgServer> <ExecuteThread: '14' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-2C4C0F3E04707E138162> <000000> <Id=sfdcCtrl; Method=com.tf.bsg.crm.sfdcCtrl.query(); Failure=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>>

 

Any thoughts how to resolve this issue.

 

thanks

pannar

jesperfjjesperfj
There is a query timeout limit, usually of 5 minutes. You need to write your query so it can execute within this time limit. Are you truly interested in getting millions of results back?
PannarPannar

I agree its a nested query, but its just one time query which would fetch the records from opportunity records at a single shot.

Is there any solution to avoid this error? Yes, i might be getting HUGE number of records and write them into excel sheet thru java program.

I didn't want to see this exception like Connection time out, Query time out , socket exception from the web logic server.

please guide me how to get rid of this error