We've got several hundred InnoDB tables in a database, and we use phpMyAdmin to manage them. Unfortunately, phpMyAdmin does a SHOW TABLE STATUS
query whenever the list of tables is shown, and this seems to dig into each InnoDB table to get an approximate row count.
This seems to lock up the entire database, which subsequently means all other queries to this (busy) database all queue up until the database hits the max users.
- Can
SHOW TABLE STATUS
be sped up in a reasonable manner? - Can phpMyAdmin be easily modified to not do a full
SHOW TABLE STATUS
query, or at least not lock the entire database at once for it?
SHOW TABLE STATUS
doesn't lock tables—at least, I've certainly never encountered it doing so. Furthermore, the row count for InnoDB inSHOW TABLE STATUS
is just an estimate, so it's definitely not doing aCOUNT(*)
or moral equivalent. What do you get from aSHOW PROCESSLIST
while theSHOW TABLE STATUS
is running?One possibility to investigate: your
table_open_cache
might be too small, causing you to get stuck closing and re-opening many tables in the course of running your status query.Just discovered the
innodb_stats_on_metadata
setting, which appears to do the trick. Disables InnoDB's diving into the indexes to get approximate counts.