Categories
mysql performance

MySQL update/write query analysis (query profiling)

Do you have a slow MySQL update/insert/delete query? Obviously, for ‘SELECT’ queries you can prepend the query with “EXPLAIN ” – however that doesn’t work for the other query types (UPDATE/INSERT/DELETE). So, one solution which may explain why the query is slow is to turn on MySQL’s profiling functionality, like in the following example :

Categories
development performance php

Zend_Cache – automatic cache cleaning can be bad, mmkay?

$customer uses Zend_Cache in their codebase – and I noticed that every so often a page request would take ~5 seeconds (for no apparent reason), while normally they take < 1 second … Some rummaging and profiling with xdebug showed that some requests looked like : Note how there are 25,000 or so calls for […]

Categories
development php

Late to the performance party

Everyone else probably already knows this, but $project is/was doing two queries on the MySQL database every time the end user typed in something to search on to get the data between a set range (SELECT x,y….. LIMIT n, OFFSET m or whatever) and another to get the total count of records (SELECT count(field) ….). […]