Consider a case where you have a single PostgreSQL database. Then you add a replica (hot standby) and you send all the reads to that replica. This is what does Rails for example.
Does this gives any performance benefit? For my understanding the answer is no.
Let me explain:
- when you have only a single database it gets N writes and M reads
- when you add the replica, the replica has to perform N writes (replicate them) and M reads... so there isn't any advantage.
Basically adding replicas does not add any benefit for writes (i.e. 2 x number of machines => 2 x number of writes).
The only advantage would be to split the reads: but in that case you need to split the reads between the master and the replica (or between multiple replicas), otherwise it is useless. So the strategy adopted by Rails (i.e. moving all reads to the single replica) seems not effective to me.
Am I missing something? Is the write work performed by a replica less then the work of the master (considering that each update must be applied to both the machines)?