innodb_adaptive_hash_index
Build in-memory hash indexes on hot B-tree pages automatically.
- 預設
OFF- Range
- ON, OFF
- Restart needed
- 否
- Default checked on
- MySQL 8.4 LTS
其作用
Speeds up repeated equality lookups on cached data, but its latches became a contention point under mixed read/write load, which is why 8.4 turned it off.
預設值
OFF. OFF since MySQL 8.4 (ON in 8.0).
Check the current value
SHOW GLOBAL VARIABLES LIKE 'innodb_adaptive_hash_index'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'innodb_adaptive_hash_index';
Change it
SET GLOBAL innodb_adaptive_hash_index = ON; -- until the next restart SET PERSIST innodb_adaptive_hash_index = ON; -- now and after restarts
No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When to change it
Benchmark turning it on for read-mostly workloads with many repeated point lookups.
What can go wrong
Latch contention on the hash index under concurrent writes, which can make throughput worse than with it off.
Questions about innodb_adaptive_hash_index
What is the default value of innodb_adaptive_hash_index in MySQL?
OFF. OFF since MySQL 8.4 (ON in 8.0).
Does changing innodb_adaptive_hash_index require a restart?
No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When should I change innodb_adaptive_hash_index?
Benchmark turning it on for read-mostly workloads with many repeated point lookups.
Back to all MySQL settings, or check the MySQL manual for every option.
Check innodb_adaptive_hash_index on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.