<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