If I have 3 databases
- Db1: only for writes, publisher
- Db2: only for reads, subscriber to Db1
- Db3: only for reads, subscriber to Db1
Just to clarify that "only for reads" means that my application won't try to modify that database. The inverse applies to "only for writes". I'm not talking about a feature of the database itself. Maybe I will use permissions to accomplish that, but regardless.
Some questions which I couldn't locate answers to by skimming through the official documentation for logical replication:
In a scenario where there's a new write to Db1, will Db2 and Db3 both lock while synchronizing to the changes, or are they going to allow reads to be made in parallel with the synchronization?
If the subscriber server is executing a read by the time a new change to Db1 is published, will the available change be the next operation to be executed as soon as they arrive at the subscriber, regardless of how many reads were already waiting to be executed (if any)?
My concern is with consistency in a load-balanced cluster of (only for reads) PostgreSQL servers which are replicas of Db1. They all should be in sync with Db1, not allowing any new reads to them before synchronizing to new changes published by Db1. If I can't do that with logical replication, then what are the alternatives, if any?