News for hackers. Stuff that matters.
Re:You'll regret using natural keys by cogman10 on Wednesday June 05, 2024 @06:13PM (#40591200)
As always, depends on the implementation.

Hash maps should generally always have faster lookups than Btree based structures. However, they'll have slower writes especially when contested. A key issue hash tables have to deal with is what happens when a remapping needs to happen. For example, when 2 keys have the same hash. In that case, locking becomes a lot more messy.

For a btree this is simpler. It's built to be able to handle reshuffling and rebalancing in a way that's semi easy to have fine grained locks around.

Re:You'll regret using natural keys by hot_gril on Wednesday June 05, 2024 @06:50PM (#40591554)
Hm yeah, now I'm wondering how MySQL implements it. Consistent hashing is one way to limit the scope of a remap.
Re:You'll regret using natural keys by hot_gril on Thursday June 06, 2024 @08:51PM (#40604182)
(But it seems like an ordered index is fundamentally easier for write performance)