mysql truncate 的问题
2024-09-16 02:30:00
问题是微信群里一伙计提的
`mysql truncate 空表都需要3 4秒,要优化解决`
一开始觉得这莫名其妙,因为作这种操作的都是后台运维,不是实时的对外服务,运维又不差这3秒
其反应truncate表时 别的所有业务都阻塞
查看还真是个问题
官方也有说明
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操作 就不该在线上服务器发生
最新文章
- Linux驱动开发——pr_fmt的用法
- PHP 通过百度API 实现通过城市名称获取经度
- ZYNQ学习之——MIO
- 《笨办法学C》笔记之指针
- 微信小视频复制到手机本地Android APP 分享
- Appium+Robotframework实现Android应用的自动化测试-4:AppiumLibrary介绍和安装
- 新版PHP 7效能實測:Drupal 7能快70%,碎形計算大勝Ruby和Python
- jQuery:多个AJAX/JSON请求对应单个回调并行加载
- 关于Java中的构造方法和set方法()给属性赋值
- button变成href (即按钮超链效果)
- iterable
- C#中调用HttpWebRequest类中Get/Post请求无故失效的诡异问题
- 微信小程序简单入门理解
- Java 敏感词过滤,Java 敏感词替换,Java 敏感词工具类
- OI黑科技:读入优化
- pytest 12 函数传参和fixture传参数request
- 解题(GeLeiMa -生成格雷码)
- VUE组件 之 Toast (Vue.extend 方式)
- Entity Framework 5中遇到的 mysql tinyint(1) 转换为 bool 的问题 (我用的是VS2013中的EF5版本)
- 【DB2】表空间相关详细说明