UPDATE jos_content SET hits = ( hits + 1 ) WHERE id='123'

The log says this took 7 seconds. There's an index on "id". There are only 400 or so records in the whole table. It's not like there are a million records and no index.

Is there ANY rational reason this query would EVER take 7 seconds to execute?

It could be worth either doing an analyze (http://dev.mysql.com/doc/refman/5.0/en/analyze-table.html) or possibly doing a dump/restore - in case there is lots of "bloat" either in the indexes or tables. Normally you wouldn't see this with mysql (especially myisam) but it's worth a shot.

What other queries are running at the same time? (use 'show processlist' inside mysql to get a list), maybe you're getting lots of hits to the same tables and myisam is locking everything, and it's time to convert to innodb.

Postgresql & php tutorials

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

Reply via email to