All Questions
Database Indexing medium

Hash Indexes are O(1). Why are they rarely the default compared to B-Trees?

  1. A They consume significantly more system memory (RAM) than B-Trees due to the need for a massive, pre-allocated hash buckets array.
  2. B They cannot support range-based query predicates (e.g., `> 100`) or sort operations because the hash function randomizes the data's order.
  3. C They are strictly non-durable and are automatically wiped from the disk whenever the database engine performs a standard restart or shutdown.
  4. D The excessive number of hash collisions for large datasets makes them fundamentally slower than O(log N) tree traversals for most workloads.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions