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: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add sub-transaction overflow status in pg_stat_activity
Date: 2022-01-13 10:25:49
Message-ID: CAFiTN-v76HAWwO4E9YNtScmE1BaFV1oww_pfWR4p3p3goNLkVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 17, 2021 at 9:32 AM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:

> On Fri, Dec 17, 2021 at 09:00:04AM +0530, Dilip Kumar wrote:
> > On Tue, Dec 14, 2021 at 3:57 AM Bossart, Nathan <bossartn(at)amazon(dot)com>
> wrote:
> > >
> > > On 12/13/21, 6:30 AM, "Dilip Kumar" <dilipbalaut(at)gmail(dot)com> wrote:
> > > > On Tue, Dec 7, 2021 at 11:11 AM Justin Pryzby <pryzby(at)telsasoft(dot)com>
> wrote:
> > > >> 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;
> > > >
> > > > I have provided two function, one for subtransaction counts and other
> > > > whether subtransaction cache is overflowed or not, we can use like
> > > > this, if we think this is better way to do it then we can also add
> > > > another function for the lastOverflowedXid
> > >
> > > The general approach looks good to me. I think we could have just one
> > > function for all three values, though.
> >
> > If we create just one function then the output type will be a tuple
> > then we might have to add another view on top of that. Is there any
> > better way to do that?
>
> I don't think you'd need to add a view on top of it.
>
> Compare:
>
> postgres=# SELECT 1, pg_config() LIMIT 1;
> ?column? | pg_config
> ----------+----------------------------
> 1 | (BINDIR,/usr/pgsql-14/bin)
>
> postgres=# SELECT 1, c FROM pg_config() c LIMIT 1;
> ?column? | c
> ----------+----------------------------
> 1 | (BINDIR,/usr/pgsql-14/bin)
>
> postgres=# SELECT 1, c.* FROM pg_config() c LIMIT 1;
> ?column? | name | setting
> ----------+--------+-------------------
> 1 | BINDIR | /usr/pgsql-14/bin
>

Okay, that makes sense, I have modified it to make a single function.

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

Attachment Content-Type Size
v3-0001-Add-functions-to-show-subtransaction-count-and-ov.patch text/x-patch 7.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2022-01-13 10:31:24 Re: Add sub-transaction overflow status in pg_stat_activity
Previous Message Julien Rouhaud 2022-01-13 10:23:42 Re: Implementing Incremental View Maintenance