Re: Resetting spilled txn statistics in pg_stat_replication - Mailing list pgsql-hackers

From Ajin Cherian
Subject Re: Resetting spilled txn statistics in pg_stat_replication
Date
Msg-id CAFPTHDY2X4M7HOC9hPA3_i-hD-5ROXn61fUsra_UiJ0Jb24s0g@mail.gmail.com
Whole thread Raw
In response to Re: Resetting spilled txn statistics in pg_stat_replication  (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>)
Responses Re: Resetting spilled txn statistics in pg_stat_replication
List pgsql-hackers


On Thu, Jul 2, 2020 at 1:31 PM Masahiko Sawada <masahiko.sawada@2ndquadrant.com> wrote:


Thanks! Yes, I'm working on this patch while considering to send the
stats to stats collector.

I've attached PoC patch that implements a simple approach. I'd like to
discuss how we collect the replication slot statistics in the stats
collector before I bring the patch to completion.


I understand the patch is only in the initial stage but I just tried testing it. Using the patch, I enabled logical replication and created two pub/subs (sub1,sub2) for two seperate tables (t1,t2). I inserted data into the second table (t2) such that it spills into disk.
Then when I checked the stats using the new function pg_stat_get_replication_slots() , I see that the same stats are updated for both the slots, when ideally it should have reflected in the second slot alone.

postgres=# SELECT s.name, s.spill_txns,    s.spill_count,    s.spill_bytes   FROM pg_stat_get_replication_slots() s(name, spill_txns, spill_count, spill_bytes);
 name | spill_txns | spill_count | spill_bytes
------+------------+-------------+-------------
 sub1 |          1 |          20 |  1320000000
 sub2 |          1 |          20 |  1320000000
(2 rows)

I haven't debugged the issue yet, I can if you wish but just thought I'd let you know what I found.

thanks,
Ajin Cherian
Fujitsu Australia

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: new heapcheck contrib module
Next
From: Peter Eisentraut
Date:
Subject: Re: POC: rational number type (fractions)