3 ms·
They can be. Multi-master DB clusters, unless they're built on consensus (and boy how slow that would be), usually are. Read-replicas, though, don't have much
by derefr 10y ago
They can be. Multi-master DB clusters, unless they're built on consensus (and boy how slow that would be), usually are.
Read-replicas, though, don't have much to do with that; a read-replica is essentially a point-in-time snapshot of the DB, that's going to get replaced with an updated snapshot every few milliseconds as WAL-log events stream in. That isn't "eventually consistent"; it's just "inconsistent." You're always looking at the past when you're talking to a read-replica.
If you need to update values using a client-side calculation, you'll need to do all that in a single transaction to get ACID guarantees. Since a transaction can only be "against" one node, and since the transaction will contain a write, that transaction (including both its reads and its writes) is forced to happen against a master node. A read-replica just isn't involved in the writing "story."