msql perfomance: fast through mysql, slow through php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

I have search the archives over the last two years and have not found any help for this question.

The basic setup: An apache/php server exists on the west coast of the US, and a linux/mysql server on the east coast.

My PHP snippet looks like this:

$result = mysql_query("select acolumn from atable where bcolumn=0", $db);
while ($row = mysql_fetch_assoc($result)) echo 'some stuff from the row';


The problem is, that the above snippet, to return seven rows, takes about 15 seconds. Putting timing statements around the query and around the fetch calls shows that the query call takes only 0.03 seconds. However, each fetch call takes anywhere from 0.5 to 5 seconds each to complete.


However, if I am logged onto the apacher server and from the user prompt run the 'mysql' client, and perform the same exact query, the 'mysql' client can peform the query and return all the results, all 7 rows, in 0.1 second.

This is apache 1.3/php 4.3.4 and mysql 4.0.17-standard.

I have tried all the mysql_connect flags without any change.

Should I expect such a performance difference? Is there something else I need to look for?

Thank you for your time,
jde

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux