RE: Monitor repl slot size

From: Igor Neyman <ineyman(at)perceptron(dot)com>
To: Nicola Contu <nicola(dot)contu(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Cc: Alessandro Aste <Alessandro(dot)aste(at)gtt(dot)net>
Subject: RE: Monitor repl slot size
Date: 2018-07-13 14:30:03
Message-ID: DM5PR17MB15327DB179369468760EEE56DA580@DM5PR17MB1532.namprd17.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: Nicola Contu [mailto:nicola(dot)contu(at)gmail(dot)com]
Sent: Friday, July 13, 2018 6:19 AM
To: pgsql-general(at)lists(dot)postgresql(dot)org
Cc: Alessandro Aste <Alessandro(dot)aste(at)gtt(dot)net>
Subject: Monitor repl slot size

Hello,
we used to monitor the replication slot size on postgres 9.6.6 with the following query:

SELECT pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) FROM pg_replication_slots WHERE slot_name = 'SLOT NAME';

We are moving to postgres 10.4 and we saw the pg_xlog_location_diff is not there anymore.

I know we can re-create it following this link : https://github.com/DataDog/integrations-core/issues/907

but, is there any better way to do it? Any replacement for that function on postgres 10?

Thanks a lot,
Nicola

I’m compare current_wal_lsn to confirmed_flush_lsn:

SELECT confirmed_flush_lsn, pg_current_wal_lsn(), (pg_current_wal_lsn() - confirmed_flush_lsn) AS lsn_distance -- returned as NUMERIC
FROM pg_catalog.pg_replication_slots
WHERE slot_name = 'Slot NAME';

Regards,
Igor Neyman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Łukasz Jarych 2018-07-13 14:39:08 Re: Read only to schema
Previous Message kpi6288 2018-07-13 14:13:34 AW: Disable TRUST authentication by using ClientAuthentication_hook