Hey fellow PHP-codemonkeys. :)

Let me start by laying out some facts:

SELECT e.NAME AS customer, g.NAME AS driver_lastname, g.FIRSTNAME AS 
driver_firstname, $CommonSQL, COUNT(g.NAME) AS number FROM ENTITY e, ENTITY 
g, EXPERTISE_FILE f, DAMAGE_CASE d WHERE (f.CUSTOMER = '$CustomerID') AND 
(e.ID = f.CUSTOMER) AND (g.ID = f.DRIVER) AND (d.OWNER_EXP_FILE = f.ID) AND 
(f.DATE_REPORT BETWEEN '$StartDate' AND '$EndDate') GROUP BY e.NAME, g.NAME, 
g.FIRSTNAME

The query above is one of the statistics gathering queries in my application. 
This one will run flawlessly.
If however I add this condition: "AND (f.DRIVER = '$DriverID')" before "AND 
(g.ID = f.DRIVER), the script will eat all CPU and RAM (and eventually swap 
aswell) on my PowerEdge 2500SC.
If I run both queries from inside psql (I use PostgreSQL), they -both- (!) 
complete within split seconds...

If I leave set_time_limit() on the default of 30 secs, my script will time 
out somewhere around these lines (though it seems like coincidence...):
function CalcDenied
(
$Requested,
$Agreed
)

{
$Denied = $Requested - $Agreed;    --> Timeout here
if ($Denied < 0)                   --> Sometimes here
    {
    $Denied = 0;
    }

return $Denied;
}

To me, this does not seem to make any sense, especially since the first query 
(without the additional condition) runs fine, whilst it has to return many 
more rows.

Does anyone have any idea what could be going on? 
If you reply, please include a CC for me, as I am on digest (I don't have 
time to sort through all the messages at work anyway, but I do contribute 
from home. :)

Thanks

-- 
Alexander Deruwe ([EMAIL PROTECTED])
AQS-CarControl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to