3 ms·
> How would you e.g. uphold the integrity of file that stores the state of a autoincrementing field if you didn't use a singleton writer? I mean, you wouldn't
by derefr 7y ago
> How would you e.g. uphold the integrity of file that stores the state of a autoincrementing field if you didn't use a singleton writer?
I mean, you wouldn't get write-concurrency for that field. And in fact you'd avoid serial PKs in general in a write-concurrent design, in favor of e.g. client-generated UUIDs.
Where you'd get wins is when 1000 different clients are each opening a transaction and upserting 1000 rows, with, say, 50% of them being duplicates of other clients' rows. Rather than linearizing+deduping all of those right away, you can just write down all 1000 individual MVCC-world-state WAL log fragments concurrently, as 1000 queued write-batches. This lets you take actual advantage of all those write IOPS that RAIDed NVMe gets you.