Re: equivalent of @@TRANCOUNT PostgreSQL - Mailing list pgsql-admin

From Tom Lane
Subject Re: equivalent of @@TRANCOUNT PostgreSQL
Date
Msg-id 2045346.1622299864@sss.pgh.pa.us
Whole thread Raw
In response to RE: equivalent of @@TRANCOUNT PostgreSQL  (<dave@davebolt.co.uk>)
List pgsql-admin
<dave@davebolt.co.uk> writes:
> @@TRANCOUNT: Transaction count.
> How many transactions are open at the moment.
> I’m not seeing anything that looks appropriate. As far as I can see it might be possible to do something using the
StatisticsCollector, see https://www.postgresql.org/docs/13/monitoring-stats.html 

Yeah, something like this should do for that:

select count(*) from pg_stat_activity where state is not null;

            regards, tom lane



pgsql-admin by date:

Previous
From: MichaelDBA
Date:
Subject: Re: equivalent of @@TRANCOUNT PostgreSQL
Next
From: Tom Lane
Date:
Subject: Re: equivalent of @@TRANCOUNT PostgreSQL