问题是微信群里一伙计提的

`mysql truncate 空表都需要3 4秒,要优化解决`

一开始觉得这莫名其妙,因为作这种操作的都是后台运维,不是实时的对外服务,运维又不差这3秒

其反应truncate表时 别的所有业务都阻塞

查看还真是个问题

https://dba.stackexchange.com/questions/147600/mysql-truncate-table-blocks-queries-in-other-databases

官方也有说明

https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html

In MySQL 5.7 and earlier, on a system with a large buffer pool and innodb_adaptive_hash_index enabled, a TRUNCATE TABLE operation could cause a temporary drop in system performance due to an LRU scan that occurred when removing the table's adaptive hash index entries (Bug #68184). The remapping of TRUNCATE TABLE to DROP TABLE and CREATE TABLE in MySQL 8.0 avoids the problematic LRU scan.

解决方式是,测试用的表和线上的库隔离,或者升级mysql到8.0

原本 truncate操作 就不该在线上服务器发生

最新文章

  1. Linux驱动开发——pr_fmt的用法
  2. PHP 通过百度API 实现通过城市名称获取经度
  3. ZYNQ学习之——MIO
  4. 《笨办法学C》笔记之指针
  5. 微信小视频复制到手机本地Android APP 分享
  6. Appium+Robotframework实现Android应用的自动化测试-4:AppiumLibrary介绍和安装
  7. 新版PHP 7效能實測:Drupal 7能快70%,碎形計算大勝Ruby和Python
  8. jQuery:多个AJAX/JSON请求对应单个回调并行加载
  9. 关于Java中的构造方法和set方法()给属性赋值
  10. button变成href (即按钮超链效果)
  11. iterable
  12. C#中调用HttpWebRequest类中Get/Post请求无故失效的诡异问题
  13. 微信小程序简单入门理解
  14. Java 敏感词过滤,Java 敏感词替换,Java 敏感词工具类
  15. OI黑科技:读入优化
  16. pytest 12 函数传参和fixture传参数request
  17. 解题(GeLeiMa -生成格雷码)
  18. VUE组件 之 Toast (Vue.extend 方式)
  19. Entity Framework 5中遇到的 mysql tinyint(1) 转换为 bool 的问题 (我用的是VS2013中的EF5版本)
  20. 【DB2】表空间相关详细说明

热门文章

  1. 新iPhone要推出双卡双待这事是真的吗?
  2. JSP编码问题解决方法
  3. 18 12 30 服务器 Django 的初步使用 环境变量的调整
  4. vue 中使用 vue-fullpage
  5. PPT |《Kubernetes的兴起》
  6. maven项目编译报错处理
  7. selenium请求豆瓣网
  8. SQL优化——ORACLE
  9. Git 报错:Updates were rejected because the tip of your current branch is behind
  10. 使用linux服务器安装wordpress博客详细教程