当前位置:网站首页>Mysql OCP 28题
Mysql OCP 28题
2022-08-03 09:33:00 【51CTO】
The MySQL error log shows:
InnoDB: Warning: a long semaphore wait:
The relevant parts of the InnoDB monitor output shows:

Which two options would help avoid the long wait in the future?
A. Increase the value of the innodb_lock_wait_timeout option.
B. Increase the value of the innodb_read_io_threads option.
C. Change the table to use HASH indexes instead of BTREE indexes.
D. Set the value of innodb_adaptive_hash_index to zero.
E. Deactivate the query cache.
F. Increase the size of the InnoDB buffer pool.
Answer: DE
InnoDB存储引擎会监控对表上索引的查找,如果观察到建立哈希索引可以带来速度的提升,则建立哈希索引,所以称之为自适应(adaptive) 的。自适应哈希索引通过缓冲池的B+树构造而来,因此建立的速度很快。而且不需要将整个表都建哈希索引,InnoDB存储引擎会自动根据访问的频率和模式 来为某些页建立哈希索引。
根据InnoDB的官方文档显示,启用自适应哈希索引后,读取和写入速度可以提高2倍;对于辅助索引的连接操作,性能可以提高5倍。在我看来,自适应哈希索引是非常好的优化模式,其设计思想是数据库自优化(self-tuning),即无需DBA对数据库进行调整。
Adaptive Hash Index是针对B+树Search Path的优化,因此所有会涉及到Search Path的操作,均可使用此Hash索引进行优化,这些可优化的操作包括:Unique Scan/Range Scan(Locate First Key Page)/Insert/Delete/Purge等等,几乎涵盖InnoDB所有的操作类型
Adaptive,意味着不是所有的叶页面都会以Hash索引维护,叶页面进入Hash 索引的条件是:同种类型的操作(Scan/Insert…),命中同一叶页面的次数,超过此页面记录数量的1/16,则可将当前叶页面加入Hash索引, 用以优化后续可能的相同Search Path。
版权声明:本文为博主原创文章,未经博主允许不得转载。
MYSQL
边栏推荐
猜你喜欢
随机推荐
RSTP(端口角色+端口状态+工作机制)|||| 交换机接口分析
MySQL-DDL数据定义语言-约束
【LeetCode】226. Flip the binary tree
dflow入门3——dpdispatcher插件
What exactly does a firmware engineer do?
013-二叉树
响应式布局经典范例——巨幅背景大标题
WinCheck Script
多媒体数据处理实验1:算术编码
mysql数据库配置性能调优
Does setting the following sysctl settings require a system reboot?
MySQL的主从复制
Industry SaaS Microservice Stability Guarantee Actual Combat
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements
The display of the article list and the basics of creating articles and article details
【快手面试】Word2vect生成的向量,为什么可以计算相似度,相似度有什么意义?
Oracle 数据如何迁移到MySQL 图文详细教程
兔起鹘落全端涵盖,Go lang1.18入门精炼教程,由白丁入鸿儒,全平台(Sublime 4)Go lang开发环境搭建EP00
ClickHouse查询语句详解
二叉查找树的综合应用









