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 1jgwPo-00049e-Uk for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:24:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgwPn-0006xq-C5 for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:24: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 1jgwPm-0006xj-Cw for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:24:39 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgwPi-0000w1-AO for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:24:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CA8BE5C0003; Thu, 4 Jun 2020 16:24:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 04 Jun 2020 16:24:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=U C6JFsv4xCmVhaN5e8ESslWaFIQ2ljIPRyvpLbWHZV4=; b=SbZSzjzY7WxzAMncO wLTyxrnBB9r4E90mv20X0ZEa2dHKVgvur34KyX84jRYS+m8uCva3kRXd6VfMYGki 9GONAsb12SxjYS54fVDGbMYYAw+GZXcS04U54TogiUSv0lGNmnHKnB7fBbcqB85Z fF63f212talWaAQ4HgD7vhGK6FWYt/I0cmFbXLrWaBC3/Vc4mzae6ZycH5C0rA+Z jH31xraJ8Fx8KRSSLKzCIVgCk25Qv0apHqT9SrLvTp8/w5N6zgbuPscT6to7xUiA TO9kdE2b8/406anhvzLut5Q07MSb3sbsRRBBfF1SWsei2KvoQbLi0xDm2YWofsSz lInYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=UC6JFsv4xCmVhaN5e8ESslWaFIQ2ljIPRyvpLbWHZ V4=; b=J0LubR900YCT3BhBp5Ym8Z1E9WAZ0iR6Zxcqh2475wDzlFVb6aGPOg1uN iemZ14GoVtuWkLQezSYd78xrE3vA3h634NsSWLUAgBlzG4wqVRjaUB97VFXNi129 plSlhvABRYyVbkfbU9Oze5F/pStaqPGfZri75aA1Vb52nEYTPM5IaO4G96Go8Mmw iY/FG5dgSUWfrA5lzzzY70SIGmoCGX04dx/+nPymh0jLfDswz+RxBA0BYNFzw8O8 EtyC1tZKfL8rGWM8j1m1NFPNxje3TetCg3E6xdM8NFV/hwijRt50BfLQhObyaJUD SsaGdCcwl9ZTZRg11WmGl/5oxwC4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeguddgudegtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeduvefhve duuddvtdegjeehhffhgedvueekudetgeelgfeuvdeuveevjeeiieegieenucffohhmrghi nhepphhoshhtghhrvghsqhhlrdhorhhgpdhpghhmvghtrhhitghsrdhiohenucfkphepje ehrddujedvrdehrddvfedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id DCEAE3280059; Thu, 4 Jun 2020 16:24:30 -0400 (EDT) Subject: Re: Monitoring for long running transactions To: Samuel Smith , pgsql-general@lists.postgresql.org References: <920bb4ce-6ba8-2888-6239-52a15474fc58@net153.net> From: Adrian Klaver Message-ID: Date: Thu, 4 Jun 2020 13:24:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <920bb4ce-6ba8-2888-6239-52a15474fc58@net153.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/4/20 12:59 PM, Samuel Smith wrote: > On 6/4/20 2:29 PM, Adrian Klaver wrote: >> > > > Sorry, I should have clarified that I was aware of the pg_stat_activity > table. That is how we found the problem in the first place. And yes I > could just write a bash script and run it in cron. I just didn't know if > there was a more "official" way to go about this since it is probably a > common monitoring point and/or if something like this was already made. I guess it comes down to how much info you want. A list of monitoring tools: https://wiki.postgresql.org/wiki/Monitoring#pgcenter Haven't used it but this one: https://pgmetrics.io/ looks interesting. From here: https://pgmetrics.io/docs/ Active backends: transaction running too long, idling in transaction, waiting for locks Information on scripting above: https://pgmetrics.io/docs/scripting.html > > Regards, > > -- Adrian Klaver adrian.klaver@aklaver.com