码迷,mamicode.com
首页 > 数据库 > 详细

MySQL--DROP TABLE与MySQL版本

时间:2019-02-17 13:03:03      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:article   span   物理内存   参考   扫描   aliyun   rop   can   drop   

========================================================================

DROP TABLE与MySQL版本

MySQL在5.5版本中引入自适应hash索引,用于提升经常访问的数据页的性能,在删除表时,需要先通过扫描LRU链表找到该表在自适应hash索引使用的数据页,将这些数据从自适应hash索引中删除。如果为MySQL实例配置较多的物理内存,扫描自适应hash索引的LRU链表可能会导致数据库性能异常甚至数据库Crash。
 
MySQL 5.7版本的官方文档如下描述:
On a system with a large InnoDB buffer pool and innodb_adaptive_hash_index enabled,TRUNCATE TABLE operations may cause a temporary drop in system performance due to an LRU scan that occurs when removing an InnoDB table‘s adaptive hash index entries.
The problem was addressed for DROP TABLE in MySQL 5.5.23 (Bug #13704145, Bug #64284) but remains a known issue for TRUNCATE TABLE (Bug #68184).

对MySQL 5.6之前版本,建议使用TRUNCATE TABLE+DROP TABLE来代替直接DROP TABLE。
对MySQL 5.6及之后版本,建议直接使用DROP TABLE来删除表。

参考链接:
https://dev.mysql.com/doc/refman/5.7/en/truncate-table.html
https://yq.aliyun.com/articles/570032?spm=a2c4e.11155435.0.0.234e998bdGFhGB

MySQL--DROP TABLE与MySQL版本

标签:article   span   物理内存   参考   扫描   aliyun   rop   can   drop   

原文地址:https://www.cnblogs.com/gaogao67/p/10390415.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!