Hi Sami,

On Wed, Sep 9, 2026 at 5:42 AM Sami Imseih <[email protected]> wrote:

> The WAIT FOR docs say that "The standby_replay mode waits for the LSN to be
> replayed (applied to the database), which is useful to achieve
> read-your-writes
> consistency while using an async replica for reads and the primary for
> writes."
>
> I think that needs one more caveat.
>
> WAIT FOR success does not guarantee read-your-writes if the supplied LSN
> is before the transaction's COMMIT record.
>
> Maybe the last sentence should be qualified with:
>
> " .... the primary for writes, provided that the target LSN was
> captured after COMMIT on the primary."
>
> This may be obvious to users of this feature, but perhaps worth being
> more explicit about it.
>
> Thoughts?


Thanks for raising this! I agree this may need to be harnessed. If we
change this line, we might also want to modify the
read-your-writes-consistency chapter.
  <sect2 id="read-your-writes-consistency">
   <title>Read-Your-Writes Consistency</title>

I am also wondering whether a example like this is helpful, though it is
somehow duplicated with the existing one:
postgres=# BEGIN;
BEGIN
postgres=*# UPDATE movie SET genre = 'Dramatic' WHERE genre = 'Drama';
UPDATE 100
postgres=*# COMMIT;
COMMIT
postgres=# SELECT pg_current_wal_insert_lsn();

-- 
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

Reply via email to