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 1mqh9k-0005ks-3G for pgsql-general@arkaria.postgresql.org; Fri, 26 Nov 2021 19:45: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 1mqh9D-0007xQ-B5 for pgsql-general@arkaria.postgresql.org; Fri, 26 Nov 2021 19:44: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 1mqh9D-0007xH-0P for pgsql-general@lists.postgresql.org; Fri, 26 Nov 2021 19:44:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqh96-0000mB-DW for pgsql-general@lists.postgresql.org; Fri, 26 Nov 2021 19:44:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1AQJiTOP444717; Fri, 26 Nov 2021 14:44:29 -0500 From: Tom Lane To: Chris Cawley cc: pgsql-general@lists.postgresql.org Subject: Re: What do you do with a long running rollback In-reply-to: <110423391.2770447.1637952642367@mail.yahoo.com> References: <1977259621.1023368.1637951601701.ref@mail.yahoo.com> <1977259621.1023368.1637951601701@mail.yahoo.com> <440098.1637952136@sss.pgh.pa.us> <110423391.2770447.1637952642367@mail.yahoo.com> Comments: In-reply-to Chris Cawley message dated "Fri, 26 Nov 2021 18:50:42 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <444715.1637955869.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 26 Nov 2021 14:44:29 -0500 Message-ID: <444716.1637955869@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chris Cawley writes: > Here's the query : > | SELECT pid, age(clock_timestamp(), query_start), usename, query | > | | FROM pg_stat_activity | > | | WHERE query != '' AND query NOT ILIKE '%pg_stat_activity%' | > | | ORDER BY query_start desc; | > Return output is pid | 4 days | user | ROLLBACK I think the fault's in your query; it's presuming a long-obsolete convention about how idle sessions are represented in pg_stat_activity. These days you should be filtering on "state" or "wait_event_type". This output is just telling you that the last thing that session did, four days ago, was a ROLLBACK. regards, tom lane