#36399 [Opn->Bgs]: query from many join table in postgresql very slow  
Author Message
tony2001





PostPosted: 2006-2-15 17:12:09 Top

php-dev, #36399 [Opn->Bgs]: query from many join table in postgresql very slow ID: 36399
Updated by: email***@***.com
Reported By: maccran at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Performance problem
Operating System: freebsd 5.4
PHP Version: 5.1.2
New Comment:

Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Not PHP problem.


Previous Comments:
------------------------------------------------------------------------

[2006-02-15 09:15:44] maccran at hotmail dot com

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 this bug report at http://bugs.php.net/?id=36399&edit=1