← Back to context

Comment by benwilber0

2 years ago

Maybe? idk. Not in Postgres. The default index is a B-Tree. A hash-based index would be terrible for disk-seeking, in any case.

https://www.postgresql.org/docs/current/indexes-types.html#I...

  • Postgres has it, but it didn't used to, and it's still got caveats.

    Beyond Postgres, indexing random values is fundamentally harder than indexing sorted ones, whether you've got a hashmap or btree or something else. The often-cited O(1) lookup complexity of a hashmap assumes everything easily fits in uniform-access memory.