Re: equivalent of @@TRANCOUNT PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dave(at)davebolt(dot)co(dot)uk
Cc: "'Julien Rouhaud'" <rjuju123(at)gmail(dot)com>, mustafa(dot)pekgoz(at)forenda(dot)com(dot)tr, "'Pgsql-admin'" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: equivalent of @@TRANCOUNT PostgreSQL
Date: 2021-05-29 14:51:04
Message-ID: 2045346.1622299864@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

<dave(at)davebolt(dot)co(dot)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 Statistics Collector, 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2021-05-29 15:01:10 Re: equivalent of @@TRANCOUNT PostgreSQL
Previous Message MichaelDBA 2021-05-29 14:50:24 Re: equivalent of @@TRANCOUNT PostgreSQL