On Wed, Nov 11, 2015 at 3:23 AM, Simon Riggs <si...@2ndquadrant.com> wrote: > This causes every writer to wait. > > What we want is to isolate the wait only to people performing a write-read > sequence, so I think it should be readers that wait. Let's have that debate > up front before we start reviewing the patch.
One advantage of having writers wait is that the master and its read slaves can't ever get too far apart. Suppose the master is generating WAL much faster than the read slaves (or one of them) can replay it. You might say it sucks to slow down the master to the speed the slaves can keep up with, and that's true. On the other hand, if the master is allowed to run ahead, then a process that sends a read query to a standby which has gotten far behind might have to wait minutes or hours for it to catch up. I think a lot of people are enabling synchronous replication today just for the purpose of avoiding this problem - keeping the two machines "together in time" makes the overall system behavior a lot more predictable. Also, if we made readers wait, wouldn't that require a network roundtrip to the master every time a query on a reader wanted a new snapshot? That seems like it would be unbearably expensive. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers