php - MySql 表架构性能问题

标签 php mysql web pdo qsqlquery

我在 mysql 数据库中有下表:

CREATE TABLE `chronologicallists` (
`sno` int(250) NOT NULL AUTO_INCREMENT,   
`empSno` int(11) NOT NULL,
`dateOfHearing` date DEFAULT NULL,
 `stageOfProceedings` text CHARACTER SET latin1,
 `isDecided` tinyint(1) DEFAULT '0',
`caseSno` int(11) NOT NULL,
`isCurrent` tinyint(1) DEFAULT '1',
`isOut` tinyint(1) DEFAULT '0',
 `isTransferred` tinyint(1) DEFAULT '0',
 `c_position` smallint(2) DEFAULT '1',
 `d_method` smallint(2) NOT NULL DEFAULT '0',
  `reason_for_delay` text CHARACTER SET latin1 NOT NULL,
  PRIMARY KEY (`sno`)
  ) ENGINE=MyISAM AUTO_INCREMENT=274926 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

该表在过去 2 年多的时间里工作得很好,但从 3 天开始,它因查询 DML 执行而卡住了。执行 3 到 4 个 DML 查询后,执行相同的查询开始花费太多时间? 似乎有任何其他进程将自身附加到 mysqld,因此 mysql 执行挂起。

我使用的是 windows 2012 Server -2 64 位,mysql 版本为 5.6.14。该表的总大小为:30 MB

请指导我如何提高查询性能?

简单查询示例:

select COUNT(sno) as total from chronologicallists;

最佳答案

做一个

OPTIMIZE TABLE chronologicallists

更新索引统计信息并释放未使用的磁盘空间。

关于php - MySql 表架构性能问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26529189/

相关文章:

php - Composer Yii2 Bower : The file or directory to be published does not exist: C:\myProject\vendor\bower/jquery/dist

php - 在 PHP 中从 MySQL 表数据创建 CSV 文件

mysql - Node js不会在mysql表中插入主键

javascript - 根据内容的填充设置边框

http - mediatype、contenttype 和 mimetype 之间有什么区别?

html - 当元素低于 div 时填充底部的问题

javascript - 将 PHP 变量放在标签内

php - 从 MySQL 数据库中批量获取大数据(就像 PhpStorm 那样)

PHP 检查内容是否可用

php - 你能在 SQL 案例中使用 php 吗?