MySQL Forums
Forum List  »  Performance

Simple SELECT query hangs consistently
Posted by: Mike Blackmon
Date: November 08, 2005 11:31PM

This is driving me crazy. The following query in a PHP script will hang consistently after a precise number of iterations. It hangs using the command line or under Apache. It just hangs!!! When it does start hanging, it will hang at the same location every time. The last query to hang will always work if manually fed to the mysql. There are typically 10 rows returned for the inner query. Help!!!

$dcnNow=1;
$grid_rows=75;
forever
{
$dcnNow++;
$upperDcn=$dcnNow + $grid_rows;

sleep (1);

$dbq = "SELECT dcn,name,icon,url FROM services
WHERE dcn BETWEEN $dcnNow AND $upperDcn
ORDER BY dcn ASC LIMIT $grid_rows";

$result = mysql_query ( $dbq );

if ( $result !== FALSE )
{
while ( $row = mysql_fetch_row ( $result ) )
array_push($Services);

mysql_free_result ( $result );

foreach ( $Services as $service )
{
// Display the DCN and
$dcn = $service[0];
$service = $service[1];
$dbTime = $gridStartTime + $grid_minutes * 60;
$evalTime = $gridStartTime - ( 3 * 60 * 60 ); // Go about three hours into the past

$dbq = "SELECT * FROM programs WHERE dcn=$dcn
AND start_t BETWEEN $evalTime AND $dbTime
ORDER BY start_t ASC LIMIT 12";

$rows = mysql_query ( $dbq );
.
.
.
mysql_free_result ( $rows );
}
}

Options: ReplyQuote


Subject
Views
Written By
Posted
Simple SELECT query hangs consistently
1597
November 08, 2005 11:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.