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
EgoehringEgoehring 

Query TimeOut

Gang,
I was wondering if anyone could help here. I am trying to backup my system to another database. I am starting to get a Query Timeout when I query the Task table. It seems that if I do a simple query like "Select Id From Task" the query TimesOut. Sometimes it works, but most of the time it errors out. The Task table has over 325000 records.
 
I also tried the same query with the Apex Explorer 8 and it timesout as well.
 
All other tables are working fine. Any thoughts?  


Message Edited by Egoehring on 06-18-2008 01:57 PM
ClaiborneClaiborne
The default time out in php is 30 seconds. You can reset the timer in the code with the statement

set_time_limit ( int $seconds ).

Since you are using a QueryMore loop to retrieve all of your records, you can reset the timer each time you go through the loop.

Something like this should work.
Code:
$result = new QueryResult($client->query($query, $queryOptions));

if ($result->size > 0) {
    $records = $result->records;        
        // Cycles through additional responses if the number of records
        // exceeds the batch size
    while (!$result->done) {
        set_time_limit(10)
        $result = new QueryResult($client->queryMore($response->queryLocator));
        $records = array_merge($records, $result->records);
    }
}