The feature known as the
adaptive hash
index lets InnoDB
perform more like an
in-memory database on systems with appropriate combinations of
workload and ample memory for the buffer pool, without
sacrificing any transactional features or reliability.
If a table fits almost entirely in main memory, a hash index can
speed up queries by enabling direct lookup of any element,
turning the index value into a sort of pointer.
InnoDB
has a mechanism that monitors index
searches. If InnoDB
notices that queries
could benefit from building a hash index, it does so
automatically.
The hash index is always built based on an existing B-tree index
on the table. InnoDB
can build a hash index
on a prefix of any length of the key defined for the B-tree,
depending on the pattern of searches that
InnoDB
observes for the B-tree index. A hash
index can be partial, covering only those pages of the index
that are often accessed.