Copying to tmp table 解决方式
来源:互联网 发布:win8 怎么安装ubuntu 编辑:程序博客网 时间:2024/05/29 15:03
解决一例最近常常碰到网站慢的情况,登陆到后台,查询一下 /opt/mysql/bin/mysqladmin processlist;
发现一个查询状态为: Copying to tmp table 而且此查询速度非常慢,基本一分钟左右才出来,后面是很多查询,状态为lock。
此分析对我没有太大的作用,因此用google查询了一下,发现网上一篇文章讲得很好: Copying to tmp table on disk The temporary result set was larger than tmp_table_size and the thread is now changing the in memory-based temporary table to a disk based one to save memory.
哦,原来是这样的,如果查询超出了tmp_table_size的限制,那么mysql用/tmp保存查询结果,然后返回给客户端。
set global tmp_table_size=209715200 (200M) 再次运行此查询,用/opt/mysql/bin/mysqladmin processlist;
进行观察,发现不会出现上述问题.
至此问题解决. 调节tmp_table_size 的时候发现另外一些参数
Qcache_queries_in_cache 在缓存中已注册的查询数目
Qcache_inserts 被加入到缓存中的查询数目
Qcache_hits 缓存采样数数目
Qcache_lowmem_prunes 因为缺少内存而被从缓存中删除的查询数目
Qcache_not_cached 没有被缓存的查询数目 (不能被缓存的,或由于 QUERY_CACHE_TYPE)
Qcache_free_memory 查询缓存的空闲内存总数
Qcache_free_blocks 查询缓存中的空闲内存块的数目
Qcache_total_blocks 查询缓存中的块的总数目
Qcache_free_memory 可以缓存一些常用的查询,如果是常用的sql会被装载到内存。那样会增加数据库访问速度
发现一个查询状态为: Copying to tmp table 而且此查询速度非常慢,基本一分钟左右才出来,后面是很多查询,状态为lock。
此分析对我没有太大的作用,因此用google查询了一下,发现网上一篇文章讲得很好: Copying to tmp table on disk The temporary result set was larger than tmp_table_size and the thread is now changing the in memory-based temporary table to a disk based one to save memory.
哦,原来是这样的,如果查询超出了tmp_table_size的限制,那么mysql用/tmp保存查询结果,然后返回给客户端。
set global tmp_table_size=209715200 (200M) 再次运行此查询,用/opt/mysql/bin/mysqladmin processlist;
进行观察,发现不会出现上述问题.
至此问题解决. 调节tmp_table_size 的时候发现另外一些参数
Qcache_queries_in_cache 在缓存中已注册的查询数目
Qcache_inserts 被加入到缓存中的查询数目
Qcache_hits 缓存采样数数目
Qcache_lowmem_prunes 因为缺少内存而被从缓存中删除的查询数目
Qcache_not_cached 没有被缓存的查询数目 (不能被缓存的,或由于 QUERY_CACHE_TYPE)
Qcache_free_memory 查询缓存的空闲内存总数
Qcache_free_blocks 查询缓存中的空闲内存块的数目
Qcache_total_blocks 查询缓存中的块的总数目
Qcache_free_memory 可以缓存一些常用的查询,如果是常用的sql会被装载到内存。那样会增加数据库访问速度
0 0
- Copying to tmp table 解决方式
- Copying to tmp table on disk
- Mysql之Copying to tmp table
- mysql查询缓慢SQL State:Copying to tmp table
- Mysql中copying to tmp table事件的相关处理
- mysql慢查询问题(Copying to tmp table)
- Mysql慢查询之Copying to tmp table
- Mysql慢查询之Copying to tmp table
- mysql Copying to tmp table on disk 影响性能的解决方法
- MySql操作缓慢:copy to tmp table
- 解决Incorrect key file for table /tmp/xxx.MYI
- Incorrect key file for table ‘/tmp/#sql_bd2_0.MYI’解决
- Incorrect key file for table '/tmp/....'错误的解决--记录
- Incorrect key file for table '/tmp/....'错误的解决--记录
- 解决Can’t move ‘.svn/tmp/entries’ to ‘.svn/entries’
- 未解决Unable to use slave's temporary directory /tmp - Can't create/write to file '/tmp/SQL_LOAD-' (Err
- ERROR 126 (HY000): Incorrect key file for table '/tmp/#sql_1d87_0.MYI'; try to repair it
- mysql的"Incorrect key file for table '/tmp/#sql_1194_12.MYI'; try to repair it"问题
- 抽象类与接口
- 使用sublime结合sshfs在windows下进行linux服务器远程同步开发
- AsyncTask执行的注意事项
- Ubuntu系统安装搜狗、谷歌、五笔等输入法教程
- 【Spring实战】—— 6 内部Bean
- Copying to tmp table 解决方式
- Linux下打包压缩war,解压war和jar命令
- 让div高度跟随窗口高度自适应的方法
- Android Studio 下安卓 jni 开发错误 undefined reference to __android_log_print
- 移动端之在不同尺寸大小的手机上展示同一效果解决方案(修正二) by FungLeo
- 几款视频类库的对比
- "围观"设计模式(5)--迪米特法则(Lod,Law of Demeter)或最少知道原则(Least Knowledge Principle)
- Android 继承BaseActivity的典型用法
- web.xml is missing and <failOnMissingWebXml> is set to true[解决]