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 1jgwbD-0004ab-PU for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:36:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgwbC-0004Jh-Mr for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:36:26 +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 1jgwbC-0004JZ-Dp for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:36:26 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgwbA-00011h-B9 for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:36:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1591302982; bh=+ZhpuuJPinGPoHJ0/LnqNqVpFWd38g2BQ3/2K82uOCo=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=R6rTYdgDNF6FolXlgQ3GxOqv/h6ZMPB8g8T0rgEiu7EPgIfmQzMAgVD3dVjO/CZYJ qLUpQVhAABUoGhr7xjlcNTQbdBNxrhYFqO82SCTqq8S3h55zqrKLIYeustmM/5B7Vy P8FNc1vWIB3fiN9uJltxKydETB2QClzMamdSL5Y8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.20] ([188.174.161.145]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MDhlf-1jr9c12Z2l-00Apyk for ; Thu, 04 Jun 2020 22:36:22 +0200 Subject: Re: Monitoring for long running transactions To: pgsql-general@lists.postgresql.org References: <920bb4ce-6ba8-2888-6239-52a15474fc58@net153.net> From: Thomas Kellerer Message-ID: <4c717cc5-ac33-fd9a-a928-e78a46b63f69@gmx.net> Date: Thu, 4 Jun 2020 22:36:21 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 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: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:LhrefSFg70FHg9ER2itL0xi/CIPeETl3V2F5Itvo6Ivh3SMiRel bm2FnrtgZ6HRo7dkUmeSp0Uw9MpEHtyWodlqkW3RNIRkavFu6us0tz2uTgsdiuedZxzL97u +8Q8cOOJ+8IQZ//3lZUB9cSXz4G2UXREV56iDWon3KxbqP8XT5KIoPThrvDBQkl7a+PA+vK twWN+JOxHiUNDKoMY2bXA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:FVjSl5Qouhw=:BuEBzzr2A1CO+nWx++TNS9 TOc1Kv/a6ah2p3fb8HlLvLCqGt+xd9x5+Bg1K0G5SlMEaEaL1d7GDSED6XRSv8Fudrwwcnacj EuVnQHy3QIhtUAbt/SJ2IlPJn3g68cQ3MdLihrhV/SNb9q36OJ4b+o6V3RIwEkNwDSyw6wxlh YmZoEHo3YcEeRcTnSAdsE13JJkowRtA7H/hxN4YkpuFuX9MS8ataauftLkvReXdTtPvEdaH75 DWvCbrGxQLdCJTWMwtxPRgoGSz4iRLAclvBz8qZicDrbF/Bz3L1EWx0SzKYC2sKzD9PxVCXKq eatSy3w62X2dm1m38Cr66OuiZVUk3O/NabTd5wx8oy/xew5i3u1EbYNm3n33Sp5RZyt8jEU8K bN/lYLobm3jDVnjfUXmNrd7Ge+on3myrqarHsxnepABZYZ7Ysz2Z5LsvMWBUFMBEVZ2a7+LtD 98wCUO7DowpmSscMauSgYDPFnocDkMeJNc24EEGGn8yWg+NoDv4njPpa/vpS2LieJ5zZv4gJr gGw8t3eHKH0kxZOQMyTamsjmPIQ3EKIdt98D1rrcW4Dx2uQ4PcmPvcIhXswVfVuqeOOhdvcrR 5BXbW64AoQG0iODMd7sFotM57uytkANnCrS4fUoTKWMicvJCwEjyYBNYD80Jg+Ti72B00oeOz yu58KHyShblwfYC1BpKpeuFRCx1C+4l+DlGNQY017ZT577E9gXM0eO937o6EcHf+6PYSQccnM aVx07GpRWN0VWP+ix0NZ8Nm7Do4ebFaKhzLrd/UGUsTul9z1AZ69sMYpJVvV6o+sQtBfst949 KY9L0mgiDI8XYQ4J7/cc6LBoVEgPF7zV5wZTO8A8QXYe+vffKQagWJs/hmL/YsqAjEwY9mB9e Jh2o0aP9F3b4cqvCe5dcD8UPwRHdnCIpJECGY/UqyAhazfo2FIH4FRQpVWUaZPcw2xLRpgpGi JRbU43PJDxteV1nh4+MdO2hr69sGXLRwQefDoxZeO8C1fNDvxv5fh9V6roSoQl8Y1bn42Nlof TdHx/Q8nM88IbpBj12ep8f45pLYreOl3JGwFZ970GJT1H/fa2i2Cjk2DJB04bLYD3lSoDjNgd 4OoSTjre9gNAe2hvoPr3KxoHmx3HcocE4hEtECtdENx9BZ0isOUL6oVzYdZy0b/FsP7xMfoxO m4iM/2+4ozE6Uu1ab8zsHF7eBoUSKE+M3sNq9uT4trux6p7IrMlwwJ9/KsZQZTWPfs+gjPW4J 1qvPws72k5F47vki0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Samuel Smith schrieb am 04.06.2020 um 21:59: > 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. What about setting idle_in_transaction_session_timeout to some reasonably high value (15 minutes?) Then you would get an error in your application because the connection was terminated and you would learn early about the problem. Even with monitoring enabled, you would probably still kill those sessions manually as the application most probably can't commit them properly any more. Thomas