Re: Mysql completing Query fast but mysql->query() takes long time to return even single selects/updates

From: Date: Sun, 11 Apr 2010 23:26:17 +0000
Subject: Re: Mysql completing Query fast but mysql->query() takes long time to return even single selects/updates
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47039@lists.php.net to get a copy of this message
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 query).. What sort of mysql table is it? if it's innodb you can try it in a transaction and roll it back: begin; update blah; rollback; 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 http://www.designmagick.com/

« previous php.db (#47039) next »