MySQL--DROP TABLE与MySQL版本

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

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
posted @ 2019-02-17 10:57  TeyGao  阅读(491)  评论(0编辑  收藏  举报