今天数据后台数据反映有些迟缓后查看链接 processlist 发下好多 锁 和磁盘写入,
参考文章 : http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=3646279
http://www.cnblogs.com/JulyZhang/archive/2011/01/28/1947165.html
+-----+--------+-----------+--------------+---------+------+----------------------+---------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+--------+-----------+--------------+---------+------+----------------------+---------+
| 7 | echina | localhost | echinacities | Query | 19 | Locked |
| 31 | echina | localhost | echinacities | Query | 22 | Locked |
| 408 | echina | localhost | echinacities | Query | 22 | Locked |
| 464 | echina | localhost | echinacities | Query | 22 | Locked |
| 471 | echina | localhost | echinacities | Query | 21 | Locked |
| 499 | echina | localhost | echinacities | Query | 22 | Copying to tmp table |
| 545 | echina | localhost | echinacities | Query | 22 | Locked |
| 569 | echina | localhost | echinacities | Query | 22 | Locked |
| 588 | echina | localhost | echinacities | Query | 21 | Locked |
| 589 | echina | localhost | echinacities | Query | 21 | Locked |
| 602 | echina | localhost | echinacities | Query | 22 | Locked |
| 624 | echina | localhost | echinacities | Query | 21 | Locked |
| 647 | echina | localhost | echinacities | Query | 19 | Locked |
| 651 | echina | localhost | echinacities | Query | 22 | Locked |
| 680 | echina | localhost | echinacities | Query | 22 | Locked |
| 681 | echina | localhost | echinacities | Query | 21 | Locked |
| 688 | echina | localhost | echinacities | Query | 17 | Locked |
| 704 | echina | localhost | echinacities | Query | 22 | Locked |
| 709 | echina | localhost | echinacities | Query | 21 | Locked |
| 710 | echina | localhost | echinacities | Query | 20 | Locked |
| 711 | echina | localhost | echinacities | Query | 20 | Locked |
| 713 | echina | localhost | echinacities | Query | 19 | Locked |
| 718 | echina | localhost | echinacities | Query | 12 | Locked |
| 720 | echina | localhost | echinacities | Query | 18 | Locked |
| 729 | echina | localhost | echinacities | Query | 16 | Locked |
| 731 | echina | localhost | echinacities | Query | 15 | Locked |
| 745 | echina | localhost | echinacities | Sleep | 11 | |
| 746 | echina | localhost | echinacities | Query | 11 | Locked |
| 748 | echina | localhost | echinacities | Sleep | 10 | |
| 749 | echina | localhost | echinacities | Query | 10 | Locked |
+-----+--------+-----------+--------------+---------+------+----------------------+-
mysql默认
tmp_table_size 33554432 (33.5M)
max_heap_table_size 16777216 (16.7M)
copy to tmp table的SQL语句,这条语读的时间比较长,且这个表会被加读锁,相关表的update语句会被排进队列。如果多执行几次这样的copyt to tmp table 语句,会造成更多的语句被阻塞。
连接太多造成mysql处理慢。
copy to tmp talbe 语句产生的原因是查询需要Order By 或者Group By等需要用到结果集时,参数中设置的临时表的大小小于结果集的大小时,就会将该表放在磁盘上,这个时候在硬盘上的IO要比内销差很多。所耗费的时间也多很多。另外Mysql的另外一个参数max_heap_table_size比tmp_table_size小时,则系统会把 max_heap_table_size的值作为最大的内存临时表的上限,大于这个时,改写硬盘。
- copy to tmp table
+-----+--------+-----------+--------------+---------+------+----------------------+---------+ | Id ...
- mysql 查询copy to tmp table造成堵塞
show full PROCESSLIST; show VARIABLES like 'tmp_table_size' set GLOBAL tmp_table_size=629145600; SHO ...
- MySQL 优化 之 Copying to tmp table on disk
项目中遇到了慢查询问题 Sql语句 SELECT sum(price) AS price, `member_id` FROM `crm_upload` GROUP BY member_id ORDER ...
- mysql copy表或表数据常用的语句整理汇总
mysql copy表或表数据常用的语句整理汇总. 假如我们有以下这样一个表: id username password ----------------------------------- 1 a ...
- mysql批量进行optimize table操作
数据库运行一段时间后,有可能会有磁盘磁片产生,此时我们需要进行optimize table操作 # 获取需要optimize的表:如下为获取总大小小于80G的表进行操作:mysql -utroot - ...
- MySQL出现Waiting for table metadata lock的原因以及解决方法
转自:http://ctripmysqldba.iteye.com/blog/1938150 (有修改) MySQL在进行alter table等DDL操作时,有时会出现Waiting for tab ...
- 【转】【MySql】Waiting for table metadata lock原因分析
MySQL在进行alter table等DDL操作时,有时会出现Waiting for table metadata lock的等待场景.而且,一旦alter table TableA的操作停滞在Wa ...
- How to Quickly Create a Copy of a Table using Transact-SQL
The easiest way to create a copy of a table is to use a Transact-SQL command. Use SELECT INTO to ext ...
- detecting locked tables mysql (locked by LOCK TABLE)
detecting locked tables mysql (locked by LOCK TABLE) up vote15down votefavorite 7 I would like to kn ...
随机推荐
- SpringMVC核心技术---转发和重定向
@Controller public class Mycontroller { //转发 @RequestMapping("/adduser") public String add ...
- iOS书摘之Objective-C编程之道 iOS设计模式解析
来自<Objective-C编程之道iOS设计模式解析>一书的摘要总结 一.Prototype 原型模式 定义:使用原型实例指定创建对象的种类,并通过复制这个原型创建新的对象.(<设 ...
- nginx fpm生产环境的权限设置
http://www.2cto.com/Article/201307/231770.html
- 配置ftp服务器
计算机管理->用户->添加用户 iis网站右键->添加ftp站点(没有此选项确认已安装及开启了ftp服务)->进行相关设置即可
- Ajax 使用 FormData做为data的参数时 出现Illegal invocation
今天在用ajax向后台传递数据时出现此错误,在ajax的参数中加上 contentType: false, processData: false, 这两句即可.
- mysql数据库字段类型的选择原则
原文链接:http://blog.csdn.net/u013412790/article/details/51615407 数据库类型的选择对数据库的性能影响很大 1 . 数据类型会影响存储空间的开销 ...
- AngularJs Type error : Cannot read property 'childNodes' of undefined
参考博客: https://blog.csdn.net/u011127019/article/details/73087868 在AngularJs和JQuery插件共存咋项目中经常会遇到如下异常 T ...
- JAVA时间加工类
/** * 当天凌晨 */ public static Calendar startOfDay(Calendar c) { if (c == null) { return c; } c.set(Cal ...
- JavaScript模块化开发的那些事
模块化开发在编程开发中是一个非常重要的概念,一个优秀的模块化项目的后期维护成本可以大大降低.本文主要介绍了JavaScript模块化开发的那些事,文中通过一个小故事比较直观地阐述了模块化开发的过程. ...
- centos下的安装mysql,jdk
mysql: 如果你是用rpm安装, 检查一下RPM PACKAGE:rpm -qa | grep -i mysql如果mysql已经安装在本机,则会列出mysql安装过的文件 ,像mysql-ser ...