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 1uZ8wp-00GdkS-Rd for pgsql-performance@arkaria.postgresql.org; Tue, 08 Jul 2025 14:05:28 +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 1uZ8wn-008pq6-LA for pgsql-performance@arkaria.postgresql.org; Tue, 08 Jul 2025 14:05:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZ8wm-008ppa-R3 for pgsql-performance@lists.postgresql.org; Tue, 08 Jul 2025 14:05:25 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZ8wk-006Sru-1b for pgsql-performance@postgresql.org; Tue, 08 Jul 2025 14:05:25 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id CFE21EC0B53; Tue, 8 Jul 2025 10:05:20 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 08 Jul 2025 10:05:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1751983520; x= 1752069920; bh=iUxaoAwFY81A0cbRwZ2VDOzGWXFS7Pu7ydk4cGZskhw=; b=S rmExTkqUYp7n2/aU4KgphCJt9gUWZ1+CXKrsd/8TaQ2nwJPZlobefcTOyvPwKU3x CGFbcAsGTSEHyAvV43VeK1/vm1hmDORNS4AJZDehkxp/oezN47fyZAhXfHSKBN9G yO5s8Q/ZT18qyRZb1H5ejtrO9bP91jubnp7SgsUuC6AJn6TqOZqKLQRdbV2VmN64 NXNqcB3G7JXyXDixSTfmi4cifbnuWKDjO5uaiybHgXrg6ImzwXiloAOVRfxmmLRu /sHD/G5X9Djm/Q+V2tsa0UT7kHFtPDRUzhHeW2TkPeH546kNe3JDP8y56qz5An5K Z178yG9AYSm+FQa860kLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1751983520; x=1752069920; bh=i UxaoAwFY81A0cbRwZ2VDOzGWXFS7Pu7ydk4cGZskhw=; b=FuKAXNSXaPOr0IfNz jf88mu4LEs1JhATe6kFaUUGipxTauizH2Nr1FT+Oa41tFDihgy72Oo6g/R9kifJ3 H15xgVaz4ldgx817GJHkPTbvcggoDZWScoeaoaq869SZj1F7Dxo95U9HegrkTVLi LCjZNZ5E0FJEkv/CLqwI1zMN52NohR3wqoSp0J8I3XcvS8TglucylIc1tT+3UTCi rjSbA743xvNTPLS8BbfVWL7h8w0AXEmaGYeNBNzs3URFC5SDjBYO3eL5JnDV4eFs gDjAYwCOkDsdQocwZLSNCGvmmr3XPTeLpHQ/uRvsVHUDMl49pH/4ixA5ZPfUTrsu IOrgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdefgeekjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpemllhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgeqnecuggftrf grthhtvghrnhepkefgkefhgffghedvgfdtvddvieehveduiedtieehkeduhefgteetveek tdefkeegnecuffhomhgrihhnpehpohhsthhgrhdrvghspdgvnhhtvghrphhrihhsvggusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgdpnhgspghrtghpthhtohepvddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepughhrghrihhnshhhrghhleehsehgmhgr ihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqphgvrhhfohhrmhgrnhgtvgesphhosh htghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Jul 2025 10:05:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1751983518; bh=uN+/INqE2rooOeTdi19RBf1MT8427hxJwsObnX6QPF8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LydaP/TaAiFN+0F6Q94z084+7wFAYvyjwH/RwQvv55WT0276hjzbww4k+341B3rTe o7RhgjpWTT5YB8XhCiSk0Lf2KSUhEDeJ83HVqFe+84KuIFhORNG2q/HBlwE10zVxPG ljdn4nkQ6dfzIMAbzKdLc/MwiWAXfn4k696DqaE2j6jkZ6lgMdigZ+3naqmgnM3U+U WFPxeuS5O500fCRzKkwRbzzVO5P2v3j2WBjfYUtVWiT874//iOpwRcyGULB59cMhKe gVc3ktoe/Fub3q3n4I8UBw9Hbah7VFDCQ00MMmu0Gdcgy9JVamJQVSZQdclMM2dvjo NAXESd13G+oiQ== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 7A2F290; Tue, 8 Jul 2025 16:05:18 +0200 (CEST) Date: Tue, 8 Jul 2025 16:05:18 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Dharin Shah Cc: pgsql-performance@postgresql.org Subject: Re: WAL Replay Buffer Invalidation Conflicts During Page Truncation on Read Replicas Message-ID: <202507081405.g55lnrkhma44@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Jul-08, Dharin Shah wrote: > *Problem Summary:* > WAL replay of relation truncation operations on read replicas triggers > buffer invalidation that requires AccessExclusive locks, blocking > concurrent read queries for extended periods. Hmm, sounds like disabling truncate of the TOAST relation by vacuum could help. We have configuration options for that -- one is per table and was added in Postgres 12, changed with ALTER TABLE ... SET (vacuum_truncate=off); I think you can also do ALTER TABLE ... SET (toast.vacuum_truncate=off); to disable it for the TOAST table. Postgres 18 added a global parameter of the same name which you can change in postgresql.conf, and from the commit message it sound like it was added to cope with scenarios precisely like yours. But if for you it's always the same toast table (or a small number of them) then I would think it'd be better to change the per-table param for those. (Also, this won't require that you upgrade to Postgres 18 just yet, which sounds particularly helpful in case Aurora doesn't offer that version.) Here it's the commit message for the change in 18, see the "Discussion" link for more info: commit 0164a0f9ee12e0eff9e4c661358a272ecd65c2d4 Author: Nathan Bossart [] AuthorDate: Thu Mar 20 10:16:50 2025 -0500 CommitDate: Thu Mar 20 10:16:50 2025 -0500 Add vacuum_truncate configuration parameter. This new parameter works just like the storage parameter of the same name: if set to true (which is the default), autovacuum and VACUUM attempt to truncate any empty pages at the end of the table. It is primarily intended to help users avoid locking issues on hot standbys. The setting can be overridden with the storage parameter or VACUUM's TRUNCATE option. Since there's presently no way to determine whether a Boolean storage parameter is explicitly set or has just picked up the default value, this commit also introduces an isset_offset member to relopt_parse_elt. Suggested-by: Will Storey Author: Nathan Bossart Co-authored-by: Gurjeet Singh Reviewed-by: Laurenz Albe Reviewed-by: Fujii Masao Reviewed-by: Robert Treat Discussion: https://postgr.es/m/Z2DE4lDX4tHqNGZt%40dev.null -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ Al principio era UNIX, y UNIX habló y dijo: "Hello world\n". No dijo "Hello New Jersey\n", ni "Hello USA\n".