Re: Add sub-transaction overflow status in pg_stat_activity

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add sub-transaction overflow status in pg_stat_activity
Date: 2021-12-17 03:31:14
Message-ID: CAFiTN-uywYgvQka9-wrsbvvJpyFV_A26SgTmvpCAX0oxj-u9ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 14, 2021 at 6:23 PM Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
>
> Hi,
>
> I have looked into the v2 patch and here are my comments:
>
> + PG_RETURN_INT32(local_beentry->subxact_overflowed);
> +}
>
> Should this be PG_RETURN_BOOL instead of PG_RETURN_INT32??
>
> --
>
> +{ oid => '6107', descr => 'statistics: cached subtransaction count of backend',
> + proname => 'pg_stat_get_backend_subxact_count', provolatile => 's', proparallel => 'r',
> + prorettype => 'int4', proargtypes => 'int4',
> + prosrc => 'pg_stat_get_backend_subxact_count' },
> +{ oid => '6108', descr => 'statistics: subtransaction cache of backend overflowed',
> + proname => 'pg_stat_get_backend_subxact_overflow', provolatile => 's', proparallel => 'r',
> + prorettype => 'bool', proargtypes => 'int4',
> + prosrc => 'pg_stat_get_backend_subxact_overflow' },
>
> The description says that the two new functions show the statistics for "cached subtransaction count of backend" and "subtransaction cache of backend overflowed". But, when these functions are called it shows these stats for the non-backend processes like checkpointer, walwriter etc as well. Should that happen?
>
> --
>
> typedef struct LocalPgBackendStatus
> * not.
> */
> TransactionId backend_xmin;
> +
> + /*
> + * Number of cached subtransactions in the current session.
> + */
> + int subxact_count;
> +
> + /*
> + * The number of subtransactions in the current session exceeded the cached
> + * subtransaction limit.
> + */
> + bool subxact_overflowed;
>
> All the variables inside this LocalPgBackendStatus structure are prefixed with "backend" word. Can we do the same for the newly added variables as well?
>
> --
>
> + * Get the xid and xmin, nsubxid and overflow status of the backend. The
>
> Should this be put as - "xid, xmin, nsubxid and overflow" instead of "xid and xmin, nsubxid and overflow"?

Thanks, Ashutosh, I will work on your comments and post an updated
version by next week.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2021-12-17 03:56:59 Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET
Previous Message Dilip Kumar 2021-12-17 03:30:04 Re: Add sub-transaction overflow status in pg_stat_activity