Question: Is it possible to get the new xlog position after query execution?

From: Oleg Serov <oleg(at)slapdash(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Question: Is it possible to get the new xlog position after query execution?
Date: 2021-10-29 17:22:56
Message-ID: CAH2JyMT=UY989a9WNcu_E1OAh7GyM1YDjhKUa-060CAH5uqhuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We are using a master/slave replication system where we perform writes on
master and use replication to offload reads.

However, sometimes we have a replication lag of a few seconds and as a
result, after the update, the change is not yet available on the replica.

Is there a way to get XLOG position to which specific update query will be
written? That way we can check if our replica caught up with changes and it
is safe to read it from. Can it be done using SQL functions? Can I get that
information from query protocol?

Thank you!

--
Oleg,
Software Engineer at Slapdash

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2021-10-29 17:34:42 Re: psql syntax for array of strings in a variable?
Previous Message Philip Semanchuk 2021-10-29 17:21:19 psql syntax for array of strings in a variable?