How to detect txid visibility on standby server?

From: Sergey Burladyan <eshkinkot(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to detect txid visibility on standby server?
Date: 2014-07-30 16:45:35
Message-ID: CAJ2ymdhN3DVsvhhofA62qhwqBxRuXYOJhTquC4RO4GCd0AXVxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

Is it possible to detect what master transaction is visible on standby?

I try to use txid_current_snapshot() but it return wrong result on standby:
_master_:
create table tmp.txid_test(txid bigint, ss txid_snapshot)
begin;
insert into tmp.txid_test values (txid_current(), txid_current_snapshot());
select * from tmp.txid_test;
=> 9098493097 '9098489391:9098493097:9098489391,9098493002,9098493088'
_standby_:
select txid_visible_in_snapshot(9098493097,
txid_current_snapshot());
=> t
select count(*) from tmp.txid_test;
=> 0

So, txid_visible_in_snapshot say what 9098493097 is visible, but realy it
is not, it still not
commited on master and count on standby return 0 rows.

PS: And what does it exactly mean to get txid_current_snapshot() from
standby?

--
Sergey Burladyan

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Goess 2014-07-30 17:51:14 free RAM not being used for page cache
Previous Message Adrian Klaver 2014-07-30 14:38:35 Re: pgbouncer not finding pidfile