From: maccran at hotmail dot com
Operating system: freebsd 5.4
PHP version: 5.1.2
PHP Bug Type: Performance problem
Bug description: query from many join table in postgresql very slow
Description:
------------
from the source code, the using time in this query about
7-10 ms (for exec pg_query) but when i using EXPLAIN ANALYZE in query,
postgresql say it using 0.9 ms in query, so i think it very lost time in
pg_query 5-8 ms. Because my web page have 4-10 query per page this consume
time it make my server cannot service more than 20 page/sec (1/(5 query X
10 ms), if reduce this time it very speed up my php page
this problem not appear if query from one table , but when join table more
than one table in query it happen.
in jsp&jdbc does not have any this problem
Reproduce code:
---------------
function microtime_float()
{ list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);}
$q = "select a.id, b.id, c.id, d.id, e.id
from a,b,c,d,e
where a.id=b.aid and b.id=c.bid
and c.id=d.cid and d.id=e.did";
$time_start = microtime_float();
pg_query ($q);
$time_end = microtime_float();
$time = $time_end - $time_start;
--
Edit bug report at http://bugs.php.net/?id=36399&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36399&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36399&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36399&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36399&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36399&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36399&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36399&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36399&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36399&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36399&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36399&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36399&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36399&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36399&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36399&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36399&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36399&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36399&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36399&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36399&r=mysqlcfg