Re:Lessons learned from sharding Postgres at Notion
by ledauphin on Thursday October 07, 2021 @07:54AM
(#28785060)
does Cockroach really use key prefix, vs a hash of the key? I would have thought it would be important to avoid unexpected performance hits resulting from key generation approach.
[ Parent
| on HN ]
Re:Lessons learned from sharding Postgres at Notion
by saurik on Thursday October 07, 2021 @09:18AM
(#28785819)
It is easy enough--arguably easier, right?--to generate random keys, but if you always work with hashes of the key (which I am not claiming cockroach doesn't do, only that I would be frustrated if they do) then you lose the ability to do range queuries.
Re:Lessons learned from sharding Postgres at Notion
by andreimatei1 on Thursday October 07, 2021 @09:43AM
(#28786136)
Cockroach lets you hash-shard your keys n-ways if you choose to through a feature called hash-sharded indexes (https://www.cockroachlabs.com/docs/stable/hash-sharded-index...)
That's a trade-off: costlier range scans (a range scan turns into n scans) for avoiding a throughput-limiting hot spot.