Sometimes databases use hash tables for indexing.
This is a natural match for a key-value store.
In particular, the following KV stores offer hash table-based indexing:
-Berkeley DB [1]
-Tokyo Cabinet (and its successor, Kyoto Cabinet) [2]
-Bitcask (used in Riak) [3]
In many benchmarks, the hash-based systems perform better than tree-based ones.
The real advantage of trees, as Berkeley DB manual says:
> Btrees are better for range-based searches, as when the application needs to find all records with keys between some starting and ending value. Btrees also do a better job of exploiting locality of reference. If the application is likely to touch keys near each other at the same time, the Btrees work well.
And there is the actual answer to the question in the title.
And that is the actual answer to the question (that, and optimiz
[1]https://docs.oracle.com/cd/E17275_01/html/programmer_referen...
[2]https://fallabs.com/tokyocabinet/perldoc/
[3]http://highscalability.com/blog/2011/1/10/riaks-bitcask-a-lo...
-----------------------
TL;DR: Why? Because you can do range queries and traverse sequential elements faster.
Don't need that? Use hash.