Re: Resetting spilled txn statistics in pg_stat_replication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
Cc: "Shinoda, Noriyoshi (PN Japan A&PS Delivery)" <noriyoshi(dot)shinoda(at)hpe(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ajin Cherian <itsajin(at)gmail(dot)com>
Subject: Re: Resetting spilled txn statistics in pg_stat_replication
Date: 2020-10-19 05:25:02
Message-ID: CAA4eK1KY3oG82P4=xkGOy_AQ4yKP-gzEavqJxE4cKjzVVpMzDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 19, 2020 at 9:04 AM Masahiko Sawada
<masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
>
> On Thu, 15 Oct 2020 at 17:51, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> >
> > AFAICS, we use name data-type in many other similar stats views like
> > pg_stat_subscription, pg_statio_all_sequences, pg_stat_user_functions,
> > pg_stat_all_tables. So, shouldn't we consistent with those views?
> >
>
> Yes, they has the name data type column but it actually comes from
> system catalogs. For instance, here is the view definition of
> pg_stat_subscription:
>
> SELECT su.oid AS subid,
> su.subname,
> st.pid,
> st.relid,
> st.received_lsn,
> st.last_msg_send_time,
> st.last_msg_receipt_time,
> st.latest_end_lsn,
> st.latest_end_time
> FROM pg_subscription su
> LEFT JOIN pg_stat_get_subscription(NULL::oid) st(subid, relid,
> pid, received_lsn, last_msg_send_time, last_msg_receipt_time, latest
> _end_lsn, latest_end_time) ON st.subid = su.oid;
>
> This view uses the subscription name from pg_subscription system
> catalog. AFAICS no string data managed by the stats collector use name
> data type. It uses char[NAMEDATALEN] instead. And since I found the
> description about name data type in the doc, I thought it's better to
> have it as text.
>

Okay, I see the merit of keeping slot_name as 'text' type. I was
trying to see if we can be consistent but I guess that is not so
straight-forward, if we go with all (stat) view definitions to
consistently display/use 'name' datatype for strings then ideally we
need to change at other places as well. Also, I see that
pg_stat_wal_receiver uses slot_name as 'text', so displaying the same
as 'name' in pg_stat_replication_slots might not be ideal. So, let's
stick with 'text' data type for slot_name which means we should
go-ahead with the v3 version of the patch [1] posted by Shinoda-San,
right?

[1] - https://www.postgresql.org/message-id/TU4PR8401MB115297EF936A7675A5644151EE050%40TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-10-19 05:28:13 Re: VACUUM PARALLEL option vs. max_parallel_maintenance_workers
Previous Message Masahiko Sawada 2020-10-19 05:17:42 Re: Transactions involving multiple postgres foreign servers, take 2