时间:2021-07-01 10:21:17 帮助过:33人阅读
存储引擎会自动对个索引页上的查询进行监控,如果能够通过使用自适应哈希索引来提高查询效率,其便会自动创建自适应哈希索引,不需要开发人员或运维人员进行任何设置操作。
自适应哈希索引是对innodb的缓冲池的B+树页进行创建,不是对整张表创建,因此速度很快。
可以通过查看innodb的status来查看自适应哈希索引的使用情况。
mysql> show engine innodb status \G *************************** 1. row *************************** Type: InnoDB Name: Status: ===================================== 2019-03-07 23:37:23 0x7f1f2d34c700 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 6 seconds ------------------------------------------------------ INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 merges merged operations: insert 0, delete mark 0, delete 0 discarded operations: insert 0, delete mark 0, delete 0 Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) Hash table size 34679, node heap has 0 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s ------------------------------- END OF INNODB MONITOR OUTPUT ============================
可以看到自适应哈希索引大小,每秒的使用情况。
注意从哈希表的特性来看,自适应哈希索引只能用于等值查询,范围或者大小是不允许的。
等着查询: select * from xx where name = "xxx";
MySQL中的自适应哈希索引
标签:适应 哈希索引 out .com 解决 情况下 variable nbsp ble