10

尝试访问具有大表的数据库(此数据库中至少有 15 个表,不少于 100 万,最大 - 2000 万)。一旦我选择数据库 - phpMyAdmin 加载至少 5 分钟(甚至更多)。

如何使用表格加快页面的加载速度?

4

3 回答 3

10

将这些行粘贴到 phpMyAdmin 安装中 config.inc.php 文件的底部:

//http://future500.nl/phpmyadmin-slow-on-startup/:
$cfg['MaxExactCountViews'] = 0;//disable trying to count the number of rows in any view
$cfg['MaxExactCount'] = 0;//disable correcting the InnoDB estimates

感谢future500.nl!

我希望在我不小心删除所有数据之前几个小时就找到了这个修复程序。:-(

于 2013-01-16T03:49:41.123 回答
1

也许我们可以和其他感兴趣的人一起追捕这个?

我标记了访问缓慢的列intormation_schema.tables

SELECT 

`TABLE_CATALOG`
,`TABLE_SCHEMA`
,`TABLE_NAME`
,`TABLE_TYPE`
,`ENGINE`
,`VERSION`
,`ROW_FORMAT`      ------SLOW
,`TABLE_ROWS`      ------SLOW
,`AVG_ROW_LENGTH`  ------SLOW
,`DATA_LENGTH`     ------SLOW
,`MAX_DATA_LENGTH` ------SLOW
,`INDEX_LENGTH`    ------SLOW
,`DATA_FREE`       ------SLOW
,`AUTO_INCREMENT`  ------SLOW
,`CREATE_TIME`     ------SLOW
,`UPDATE_TIME`     ------SLOW
,`CHECK_TIME`      ------SLOW
,`TABLE_COLLATION`
,`CHECKSUM`        ------SLOW
,`CREATE_OPTIONS`
,`TABLE_COMMENT`

 FROM `tables` WHERE 1

此外,导航框架是/navigation.php调用

/libraries/common.lib.php => PMA_getTableList()然后调用

/libraries/database_interface.lib.php => PMA_DBI_get_tables_full()

其中包含慢查询之一。

我在此替换了慢速 SELECT 列:

SELECT *,
`TABLE_SCHEMA`       AS `Db`,
`TABLE_NAME`         AS `Name`,
`TABLE_TYPE`         ÀS `TABLE_TYPE`,
`ENGINE`             AS `Engine`,
`ENGINE`             AS `Type`,
`VERSION`            AS `Version`,
`ROW_FORMAT`         AS `Row_format`,
`TABLE_ROWS`         AS `Rows`,
`AVG_ROW_LENGTH`     AS `Avg_row_length`,
`DATA_LENGTH`        AS `Data_length`,
`MAX_DATA_LENGTH`    AS `Max_data_length`,
`INDEX_LENGTH`       AS `Index_length`,
`DATA_FREE`          AS `Data_free`,
`AUTO_INCREMENT`     AS `Auto_increment`,
`CREATE_TIME`        AS `Create_time`,
`UPDATE_TIME`        AS `Update_time`,
`CHECK_TIME`         AS `Check_time`,
`TABLE_COLLATION`    AS `Collation`,
`CHECKSUM`           AS `Checksum`,
`CREATE_OPTIONS`     AS `Create_options`,
`TABLE_COMMENT`      AS `Comment`

对此:

SELECT 
`TABLE_SCHEMA`        AS `Db`,
`TABLE_NAME`          AS `Name`,
`TABLE_TYPE`          AS `TABLE_TYPE`,
`ENGINE`              AS `Engine`,
`ENGINE`              AS `Type`,
`VERSION`             AS `Version`,
'Compact'             AS `Row_format`,
0                     AS `Rows`,
0                     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`,
'2000-01-01 00:00:00' AS `Create_time`,
NULL                  AS `Update_time`,
NULL                  AS `Check_time`,
`TABLE_COLLATION`     AS `Collation`,
NULL                  AS `Checksum`,
`CREATE_OPTIONS`      AS `Create_options`,
`TABLE_COMMENT`       AS `Comment`

这使得查询运行得很快。(例如,我通常不需要行数。我也可以手动获取它们。或者安装 2 个 PhpMyAdmin。)

注意:从现在开始,被覆盖的值应该在管理页面上显示为虚拟值 - 但我可以忍受这种情况,而不是缓慢的速度。

但是必须有其他慢查询很好,因为它仍然加载缓慢。

所以,只是想分享这个,有人可能会继续。现在,我没有更多的时间了。

于 2012-08-27T11:58:03.900 回答
-3

phpMyAdmin 是基于浏览器的网页工具。您为什么不尝试一些其他工具来处理数据库,例如sqlyog

于 2012-05-30T07:07:41.327 回答