Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueN2a-008jxN-1o for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jul 2025 00:09:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ueN2Z-00GC12-3n for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jul 2025 00:08:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueN2Y-00GC0u-SF for pgsql-bugs@lists.postgresql.org; Wed, 23 Jul 2025 00:08:59 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ueN2X-000I37-1K for pgsql-bugs@lists.postgresql.org; Wed, 23 Jul 2025 00:08:58 +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 56N08thH1208552; Tue, 22 Jul 2025 20:08:55 -0400 From: Tom Lane To: =?UTF-8?Q?Guilherme_Luis_Fran=C3=A7a?= cc: pgsql-bugs@lists.postgresql.org Subject: Re: [PERFORMANCE] regression: EXECUTE loop TRUNCATE slower in 17.5 vs 17.2 In-reply-to: References: Comments: In-reply-to =?UTF-8?Q?Guilherme_Luis_Fran=C3=A7a?= message dated "Tue, 22 Jul 2025 20:23:25 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1208550.1753229335.1@sss.pgh.pa.us> Date: Tue, 22 Jul 2025 20:08:55 -0400 Message-ID: <1208551.1753229335@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?Q?Guilherme_Luis_Fran=C3=A7a?= writes: > I noticed a performance regression after upgrading my test environment from > `postgres:17.2-alpine` to `postgres:17.5-alpine`. My test suite slowed down > significantly. After investigation, I narrowed it down to the way I reset > the database beforeEachTest. > The issue appears when using a PL/pgSQL `DO` block with dynamic `EXECUTE` > to truncate all tables in a loop. Hmm ... this test case runs in under 50ms for me, in a vanilla 17.5 setup. So even your older timing seems pretty slow from here. I speculate that you have some replication setup that you didn't describe and that the extra time is disappearing into that somehow. I agree that there's probably some unintended regression here, but it's hard to say what unless we can duplicate it. If you can't put your finger on what about your setup tickles the problem, maybe you could "git bisect" to discover where the behavior changed? regards, tom lane