public inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
To: Dilip Kumar <[email protected]>
Cc: [email protected]
Subject: Re: Add sub-transaction overflow status in pg_stat_activity
Date: Mon, 6 Dec 2021 23:41:24 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFiTN-uvYAofNRaGF4R+u6_OrABdkqNRoX7V6+PP3H_0HuYMwg@mail.gmail.com>
References: <CAFiTN-uvYAofNRaGF4R+u6_OrABdkqNRoX7V6+PP3H_0HuYMwg@mail.gmail.com>

> +      <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#d96d0...

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;

-- 
Justin





view thread (53+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Add sub-transaction overflow status in pg_stat_activity
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox