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 1p3pMb-0003Z2-KD for pgsql-bugs@arkaria.postgresql.org; Sat, 10 Dec 2022 02:13:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p3pMZ-0003Qu-Co for pgsql-bugs@arkaria.postgresql.org; Sat, 10 Dec 2022 02:13:15 +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 1p3pMZ-0003Ql-57 for pgsql-bugs@lists.postgresql.org; Sat, 10 Dec 2022 02:13:15 +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 1p3pMW-0002ao-Lw for pgsql-bugs@lists.postgresql.org; Sat, 10 Dec 2022 02:13:14 +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 2BA2D9Qk1185214; Fri, 9 Dec 2022 21:13:09 -0500 From: Tom Lane To: jf.levesque@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17710: Slow queries (100% CPU) after auto-vacuum In-reply-to: <17710-22ff6a35aac256ff@postgresql.org> References: <17710-22ff6a35aac256ff@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 09 Dec 2022 15:46:04 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1185212.1670638389.1@sss.pgh.pa.us> Date: Fri, 09 Dec 2022 21:13:09 -0500 Message-ID: <1185213.1670638389@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > [ query gets slower after auto-vacuum ] This sounds less like an auto-vacuum problem than an auto-analyze problem. That is, probably a background update of table statistics is happening and that is triggering the planner to pick a different plan. In an ideal world, more up-to-date stats would always result in a better plan, but reality is not always so kind. There is not enough info here to diagnose the problem though. At minimum we need to see EXPLAIN ANALYZE output for the problem query in both the fast and slow states. We have a wiki page about reporting slow-query problems [1] which asks for quite a bit of info, but for starters maybe the EXPLAIN ANALYZE results would be enough. > I am having an issue that started with 11.0 and is still present with 11.18. > The issue is not present with 10.23. If you could get EXPLAIN ANALYZE results from v10 as well as v11, that would be useful too. regards, tom lane [1] https://wiki.postgresql.org/wiki/Slow_Query_Questions