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

- Thread: https://externals.io/message/47826
- Original archive: https://news-web.php.net/php.internals/47826
- Started by David on 2010-04-07T18:04:33+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #47826 — David — 2010-04-07T18:04:33+00:00

URL: https://externals.io/message/47826#47826

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)
 
 
04/06/2010 14:54:54 20.6899s  UPDATE `calls` SET `Result`='Busy' WHERE
`CallID`='144786'
     | Status               | Duration | CPU_user | CPU_system |
Context_voluntary | Context_involuntary | Block_ops_in | Block_ops_out |
Messages_sent | Messages_received | Page_faults_major | Page_faults_minor |
Swaps | 
 
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------------------------------------------------
     | starting             | 0.000039 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | checking permissions | 0.000008 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | Opening tables       | 0.000010 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | System lock          | 0.000005 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | Table lock           | 0.000006 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | init                 | 0.000036 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | Updating             | 0.000099 | 0.001000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | end                  | 0.000023 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | query end            | 0.000004 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | freeing items        | 0.007410 | 0.000000 | 0.000000   | 4
| 1                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | logging slow query   | 0.000004 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     | 
     | cleaning up          | 0.000004 | 0.000000 | 0.000000   | 0
| 0                   | 0            | 0             | 0             | 0
| 0                 | 0                 | 0     |

 

 

Thanks

David Murphy
