From: Chris on
David Murphy wrote:
> As you can see PHP claims it took 20 seconds for mysql->query() to return
> but mysql think is took around 1.0s
> This is from our application
> I enabled profile in mysql to determine why an update took 20seconds. As
> you can see MySQL reported no where near that amount of duration took
> place.
> Is there any way I can dig into php and determine why mysql client libs are
> so slow (this is not using mysqlnd but mysql-client-libs on CentOS using
> 5.3.2)

Is this a one-off thing or is it happening all the time?

If it's a one-off thing it could be a spurious result (maybe someone
else was doing a mysqldump when your query ran, the dump blocks your

What sort of mysql table is it? if it's innodb you can try it in a
transaction and roll it back:

update blah;

see how long it takes.

if it takes a short time in the mysql client, then try it in a php
script from your other server.

Postgresql & php tutorials