1

PostgreSQL9.6 add new setting remote_apply for configuration parameter synchronous_commit, Reading the following document I still don't understand the difference between on the setting on and remote_apply. Can anyone help me? thanks a lot .

synchronous_commit (enum)

Specifies whether transaction commit will wait for WAL records to be written to disk before the command returns a "success" indication to the client. Valid values are on, remote_apply, remote_write, local, and off. Can anyone help me? thanks a lot.

When set to on, commits will wait until replies from the current synchronous standby(s) indicate they have received the commit record of the transaction and flushed it to disk. This ensures the transaction will not be lost unless both the primary and all synchronous standbys suffer corruption of their database storage. When set to remote_apply, commits will wait until replies from the current synchronous standby(s) indicate they have received the commit record of the transaction and applied it, so that it has become visible to queries on the standby(s)

synchronous_commit

http://www.postgresql.org/docs/9.6/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT

1 Answer 1

4

When the standby initially receives the log records, the are written to the standby's pg_xlog directory. So those records are there for safekeeping, but they have not yet been applied to the shared_buffers and the data files (and the pg_clog, etc.) Until they are applied, anyone connecting to the standby cannot see the effects of those records.

It is kind of like the difference between getting a note from the post office saying "Your envelope has been delivered" (synchronous_commit=on) and getting a note from your bank saying "Your envelope had been received, opened, processed, and your instructions have been carried out and your account has been credited with the proceeds, have cleared, and are now available for withdrawal" (synchronous_commit=remote_apply).

1
  • For the configuration parameter synchronous_commit, What's the the difference between the setting on and remote_apply?I think the both are the same.
    – francs
    May 21, 2016 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.