pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: dave@davebolt.co.uk
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: mustafa.pekgoz@forenda.com.tr, 'Pgsql-admin' <pgsql-admin@lists.postgresql.org>
Subject: Re: equivalent of @@TRANCOUNT PostgreSQL
Date: Sat, 29 May 2021 11:08:16 -0400
Message-ID: <20210529150816.GB23127@momjian.us> (raw)
In-Reply-To: <042901d75497$c2da72d0$488f5870$@co.uk>
References: <004101d7548b$894e0ce0$9bea26a0$@forenda.com.tr>
	<CAOBaU_bwoQ8Hos1rrMHmGyzA5TfP0oJ0J3tHGYabod_Pe6YwHw@mail.gmail.com>
	<042901d75497$c2da72d0$488f5870$@co.uk>

On Sat, May 29, 2021 at 03:34:41PM +0100, dave@davebolt.co.uk wrote:
> @@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
> 
> Hope someone knowledgeable on PostgreSQL will have an answer.
> 
> I did find this from 2006. https://www.postgresql.org/message-id/
> eg5op3$ria$1@sea.gmane.org

Uh, the only way I know to do that is to query pg_stat_activity like
this:

	SELECT *
	FROM pg_stat_activity
	WHERE state != 'idle' AND backend_type = 'client backend';

However, the purpose of why you are using these values probably is not
going to translate to Postgres easily.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






view thread (11+ messages)  latest in thread

Message-ID: <20210529150816.GB23127@momjian.us>
Permalink:  ../20210529150816.GB23127@momjian.us/
Also on:    postgresql.org/message-id/20210529150816.GB23127@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: bruce@momjian.us, dave@davebolt.co.uk, rjuju123@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: equivalent of @@TRANCOUNT PostgreSQL
  In-Reply-To: <20210529150816.GB23127@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox