You may have recently switched over from MyISAM tables to InnoDB, or in fact used InnoDB for a long time. phpMyAdmin has been a mainstay tool for quick viewing and editing of databases, but unfortunately seems to grind to a halt after clicking to view a particular database.
This is mainly due to the way that SELECT COUNT(*) FROM TABLE is calculated. MyISAM keeps that kind of metadata at hand so can instantly calculate the value while InnoDB does not. phpMyAdmin doesn’t recognise this major difference; which means that if you have big InnoDB tables or a number of medium sized ones, loading up a database’s details can take a number of seconds, even minutes. It also is sucking up resources while it intensely tries to calcuate some statistics about your tables.
If you are not too interested in the general stats of a database, and more interested in viewing and manipulating the tables, there is a small hack you can make to one of phpMyAdmin’s PHP files that will load tables up instantly, namely libraries/database_interace.lib.php.
At around line 290 there is a variable $sql declared (it is declared a number of times in the script but we’re interested in this instance), edit the $sql command to this:
$sql = ' SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,TABLE_TYPE,ENGINE,'Compact' AS `ROW_FORMAT`, 999999 AS `TABLE_ROWS`,99999 AS `AVG_ROW_LENGTH`, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`, `ENGINE` AS `Engine`, `ENGINE` AS `Type`, `VERSION` AS `Version`, 0 AS `Row_format`, 999999 AS `Rows`, 999999 AS `Avg_row_length`, 0 AS `Data_length`, 0 AS `Max_data_length`, 0 AS `Index_length`, 0 AS `Data_free`, 0 AS `Auto_increment`, 0 AS `Create_time`, 0 AS `Update_time`, 0 AS `Check_time`, `TABLE_COLLATION` AS `Collation`, 0 AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment` FROM `information_schema`.`TABLES` WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN ('' . implode("', '", $this_databases) . '') ' . $sql_where_table;
The small downside is that you can’t see row counts and some other general metadata, but it’s a small price to pay to continue using phpMyAdmin as a quick GUI reference to your database. I can verify that a 600M row database (10 tables) originally took about 6 seconds to load, but loads instantly after this fix. A smaller 150M row database (40 tables, lots of table partitions) would take up to 30 seconds to load and hang my browser… now only takes a second to spark up.
Credit goes to Richard Dale in the Source Forge forum, who created this workaround. I thought I would dedicated a post to this as the issue does not seem to be too prominent. With MySQL soon to use InnoDB as its default database engine, no doubt this issue will come ot the fore, and phpMyAdmin will implement a more permanent workaround.