
I think I’ve done something like this with two tables with a row per shard and an exclusive (FOR NO KEY UPDATE) lock there for writers, but it wasn’t performance critical. I found that the page-based serializable checks had way too many false positives compared to row-based locking. The CAS query here with just one relation and statement is clever and I assume has much better peak throughput!
score 1 · canonical
Applying the vibecoding tag here is only going to create a “bubble”, and seems like a terrible idea for building a cohesive community.
score 1 · canonical