Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln0Iy-00085h-GF for pgsql-admin@arkaria.postgresql.org; Sat, 29 May 2021 14:51:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ln0IR-0005CD-VE for pgsql-admin@arkaria.postgresql.org; Sat, 29 May 2021 14:50:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln0IR-0005C4-M7 for pgsql-admin@lists.postgresql.org; Sat, 29 May 2021 14:50:39 +0000 Received: from mout.perfora.net ([74.208.4.197]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln0IL-0002oG-6f for pgsql-admin@lists.postgresql.org; Sat, 29 May 2021 14:50:39 +0000 Received: from [192.168.1.165] ([98.169.214.254]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MGycx-1lZY9P1IrT-00E2gV; Sat, 29 May 2021 16:50:28 +0200 Subject: Re: equivalent of @@TRANCOUNT PostgreSQL To: "David G. Johnston" Cc: "dave@davebolt.co.uk" , Julien Rouhaud , "mustafa.pekgoz@forenda.com.tr" , Pgsql-admin References: <004101d7548b$894e0ce0$9bea26a0$@forenda.com.tr> <042901d75497$c2da72d0$488f5870$@co.uk> From: MichaelDBA Message-ID: <43af0a07-99df-6125-4227-ce1c22bd1fb8@sqlexec.com> Date: Sat, 29 May 2021 10:50:24 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.48 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------831E07E11569848EF26F73E7" Content-Language: en-US X-Provags-ID: V03:K1:WZcFdCY9BaiC0QuhrkP9lMjIRLH8r5+Vo9WEVMc+3PyFuQ4BwUx FjC3OHDrU3ZIAW6QiNptuvlYXn9B2nmZrqJzt7HcNBrMtmz/z7Z1il0LpBCPEovUWfvenEY fwG0XHo2DMypDw1pLNNSYz5OTUi0vT/k1X1nJP/mkR0O/RoDh5sMSdFl10octvGIZmXAVX8 ghARFFWlWZxg1A4lrzbig== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9ZgaItiTL5I=:kTQtr1S31eu7A0TzQosOYm tXbmQ+E6D/59a4AFgilF2v/TYhYjJeajS56jlQDN2RKm8eKEvw8tqkX50ojFp2nVk/2NPRoib yn/KY0ycaH48mg9xlE4GjLs+VX082fUPUBQscq407lB+wMcMvTEQk6WMdX4V5u77GoYFVjp7z jfTurAZ+8fVjfiWBg84qigvZhFNiic+yiki1j0vqP/sKKiaYYM3F7osQILDG5PyGpszzMeJFd hNzGa1XCVNLcaMxWwQd79Z8dl38UvwclWsaNmAmcc1MH4j6JfFEvGy2fjPpT0GOFlKW+DqftS QULt+/HQX/+V0/EVcIXB1purlZb4lXuCca5VXIeUDgzDacPNOaah4VMvsW2tI/FU3dtW1U7HB Hx1qigsewiux9EMwrNZ4PrXadQNcsr24exhd29wqMH4AnlGpC9B9o9zuLhnloMYvPxJIefMye HtHi/PW2ZV0yChDMlRb2X/fKoHs04sLMm0Xd+XBcWWvGDcjAxxxFTqC/6Q4jlEf06oTxtaUbm 4+pKOOqQcnCGSxGBi+MsHk= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------831E07E11569848EF26F73E7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I don't think so, it's not current active transactions, but number of active transactions on the CURRENT CONNECTION.  No way you get that from pg_stat_activity.  So if your proc had a bunch of embedded BEGIN/END blocks, it would be that count. David G. Johnston wrote on 5/29/2021 10:44 AM: > One transaction per process actively executing a query. --------------831E07E11569848EF26F73E7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit I don't think so, it's not current active transactions, but number of active transactions on the CURRENT CONNECTION.  No way you get that from pg_stat_activity.  So if your proc had a bunch of embedded BEGIN/END blocks, it would be that count.

David G. Johnston wrote on 5/29/2021 10:44 AM:
One transaction per process actively executing a query.

--------------831E07E11569848EF26F73E7--