Re: Add sub-transaction overflow status in pg_stat_activity
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-12-13T14:28:26Z
Lists: pgsql-hackers
Attachments
- v2-0001-Add-functions-to-show-subtransaction-count-and-ov.patch (text/x-patch) patch v2-0001
On Tue, Dec 7, 2021 at 11:11 AM Justin Pryzby <pryzby@telsasoft.com> wrote: > > 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; 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 postgres[43994]=# select id, pg_stat_get_backend_pid(id) as pid, pg_stat_get_backend_subxact_count(id) as nsubxact, pg_stat_get_backend_subxact_overflow(id) as overflowed from pg_stat_get_backend_idset() as id; id | pid | nsubxact | overflowed ----+-------+----------+------------ 1 | 43806 | 0 | f 2 | 43983 | 64 | t 3 | 43994 | 0 | f 4 | 44323 | 22 | f 5 | 43802 | 0 | f 6 | 43801 | 0 | f 7 | 43804 | 0 | f (7 rows) -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
Commits
-
Fix comment that was missing a word.
- eb60eb08a95e 16.0 landed
-
Expose some information about backend subxact status.
- 10ea0f924a27 16.0 landed