当前位置:网站首页>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
边栏推荐
猜你喜欢
Exception: Dataset not found. Solution
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements
Batch PNG format can be converted to JPG format
命令行加载特效 【cli-spinner.js】 实用教程
pytorch one-hot tips
Flink Yarn Per Job - 创建启动Dispatcher RM JobManager
dflow入门3——dpdispatcher插件
【LeetCode】112. Path sum
Redis和Mysql数据同步的两种方案
播放量暴涨2000w+,单日狂揽24w粉,内卷的搞笑赛道还有机会
随机推荐
Does setting the following sysctl settings require a system reboot?
xtrabackup
015-平衡二叉树(一)
深度学习之 10 卷积神经网络1
pytorch安装错误
013-Binary tree
Exception: Dataset not found.解决办法
mysql8安装步骤教程
Redis和MySQL如何保持数据一致性
使用 Scrapy 框架对重复的 url 无法获取数据,dont_filter=True
【快手面试】Word2vect生成的向量,为什么可以计算相似度,相似度有什么意义?
Index (3)
SQL每日一练(牛客新题库)——第5天:高级查询
AUC的两种计算方式
系统io统计
多媒体数据处理实验4:LSH索引
mysql的union和union all
【网络安全】Kail操作系统
Alibaba Cloud SMS Sending
验证浮点数输入