Re: Add sub-transaction overflow status in pg_stat_activity

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add sub-transaction overflow status in pg_stat_activity
Date: 2021-12-07 10:07:42
Message-ID: CAFiTN-sG6uuRJaBBU+NaTRu6oefKtcvfKDyt+Uyvmb9B+YafuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 7, 2021 at 11:11 AM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:

Thanks for the review I will work on these comments.

> > + <entry role="catalog_table_entry"><para role="column_definition">
> > + <structfield>subxact_count</structfield> <type>xid</type>
> > + </para>
> > + <para>
> > + The current backend's active subtransactions count.
>
> subtransaction (no s)
>
> > + Set to true if current backend's subtransaction cache is overflowed.
>
> Say "has overflowed"
>
> > + if (local_beentry->subxact_count > 0)
> > + {
> > + values[30] = local_beentry->subxact_count;
> > + values[31] = local_beentry->subxact_overflowed;
> > + }
> > + else
> > + {
> > + nulls[30] = true;
> > + nulls[31] = true;
> > + }
>
> Why is the subxact count set to NULL instead of zero ?

> You added this to pg_stat_activity, which already has a lot of fields.
> We talked a few months ago about not adding more fields that weren't commonly
> used.
> https://www.postgresql.org/message-id/flat/20210426191811.sp3o77doinphyjhu%40alap3.anarazel.de#d96d0a116f0344301eead2676ea65b2e
>
> Since I think this field is usually not interesting to most users of
> pg_stat_activity, maybe this should instead be implemented as a function like
> pg_backend_get_subxact_status(pid).
>
> People who want to could use it like:
> SELECT * FROM pg_stat_activity psa, pg_backend_get_subxact_status(pid) sub;

Yeah, this is a valid point, I will change this accordingly.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-12-07 10:10:58 Re: Add sub-transaction overflow status in pg_stat_activity
Previous Message Amit Kapila 2021-12-07 10:00:59 Re: Alter all tables in schema owner fix