phpMyAdmin和大表

时间:2012-05-30 06:58:53

标签: phpmyadmin

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

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

3 个答案:

答案 0 :(得分:8)

将这些行粘贴到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!

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

答案 1 :(得分: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。)

注意:在管理页面上,被覆盖的值应该从现在开始显示为虚拟值 - 但我可以使用它而不是慢速。

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

所以,只是想分享一下,有人可能会继续这样做。现在,我没有时间了。

答案 2 :(得分:-3)

phpMyAdmin是基于浏览器的网页工具。为什么不尝试使用其他工具来处理像sqlyog这样的数据库。