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.96) (envelope-from ) id 1w2S3X-000Ine-0b for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 10:53:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2S3V-000YZ1-00 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 10:53:45 +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.96) (envelope-from ) id 1w2S3U-000YYt-2D for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 10:53:44 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2S3R-00000000Agi-02xG for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 10:53:43 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-485392de558so33346465e9.1 for ; Tue, 17 Mar 2026 03:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1773744821; x=1774349621; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=3V6hBtKYr8HKD189mtJ45jY1AQtFFWZMroSH03j+vZM=; b=Ar4gN3+YsPSKjXlsI8F+1p8Auugz3Lhd9y9ypdcC87CKEixZUHg6BGTaz+bWQreLUM M7xTURv91Y6edndROV1QCqhOEzP9DZpbgo4XhJDLEsASWtG3QK6Rrkls/kxztuQICd2U cXf1vbIprmbNTOLjEaHiLrAx/PAoA9tm2S2H1/8Y7kiowlE6qDkDEvSLjYd9AotG4NTE knB/TCLxKmTrEMyUXY4hCh6QgMF9xw9Ttx8WhRkxEtQwBjHVAYvdRLm7NHyT8V8Ht346 DiWfDZjLejhZBzIeFNl5X0MSboZ0Zp8CMwC2gclCv/zN59eTqX8FYEh3dlCR7TXpn9Fc ziow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773744821; x=1774349621; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3V6hBtKYr8HKD189mtJ45jY1AQtFFWZMroSH03j+vZM=; b=Ev+3nKcd+8UY08gbG61WPhYoPDxNSe447pLClKa8Iippd0MNU8VbN4UQ1Qwe7ErD1+ 8Zo9myQCPOw6weU11Pm5+vHIMOOkxCq2nn7DVaoc4VZgtIqCPqYbcgo8X+7Hw18Ldkac oUWc0gAm+WTzu8uXpWMgnd9EPcNQamAg9nUBA+/WFlO8wNFnaooz64GD4SN8u8ozp7O4 up1HKxKRhfuL+IFvAmuGSaYzDQ4UTgMb+dGjbCQ6Ju4D5LoZ2fs2DOa62sFzSM8MEo7n PL5F8Qigi3VuXKOWb8kTaVIraX9zOzurOwUoNGCLbJeolXTFA00r+ASN/+IA0O+XiVt5 vMGQ== X-Forwarded-Encrypted: i=1; AJvYcCXkAE60F5SxlKQL4Pcxi5JtVkZIFTjS698lwtod7zIq0JvjjPU/3d7WhIxC4cWKGdNmPjO+gCtPbFSKVGC7@lists.postgresql.org X-Gm-Message-State: AOJu0Yy7NUMY5SE6w6XUQLu0dHvw8iA7vHh7YSqw7OAI+JvsfCZXbP9H t3s038rfYfcvcdXQnTK+CoAyeSdbT4W9RAM4dy4wkkWAgE6YzIthIgRHDW4auJscOEc= X-Gm-Gg: ATEYQzzauEotFNfSTOHjcsd0+b3p67MCcABv81Ebj0TJjYVd5PzXxVNN2I8jmTZIk63 ij5MpSKxs9/sZdNkfpaafiKDR4jzWLKVh+qeV+9Vcyn63ErXtJej5EVEWFZZ8iMVGPLTDcbPNQp e+gBNYqK8/pP+f0f6IqxX3LxsD8ZXMxEu66z41LJkMDmfTjuznx2NJ7EZzye2c8cTkPpZHdT+G6 jCWlTOpO1W0QPlixUHoBVcvra4lDAdMKAHpC8CD47vVCRxq7WzcnWAilwihjni2M6ZU4X4i0lFA HT55WoczoCF2zF8TicbdeHjccfURZ9eZeNQalaBrIJ2XTkoNueI5y/FYZcCYoN/DqwX4QTCQGJW t0lAAWox6lD+Jrmab6p142Eo0K+wJeEBF1zzkxbepNvx7sLuRHl500y68k6ML0BcjpcSjT86zdz PQ73VVvYbhm7vuLvFdTlG3TlgNjnSZ5w99M2LKn4/TXqWlKIA= X-Received: by 2002:a05:600c:4583:b0:485:3983:aba8 with SMTP id 5b1f17b1804b1-4855670530dmr250114555e9.27.1773744821075; Tue, 17 Mar 2026 03:53:41 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43a0b2db487sm33219453f8f.28.2026.03.17.03.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 03:53:40 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera cc: Matthias van de Meent , Mihail Nikalayeu , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: <202603162202.l2sibdzviih7@alvherre.pgsql> References: <202603162202.l2sibdzviih7@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Mon, 16 Mar 2026 23:03:04 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9547.1773744820.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Tue, 17 Mar 2026 11:53:40 +0100 Message-ID: <9548.1773744820@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera wrote: > On 2026-Mar-16, Matthias van de Meent wrote: > = > > On Mon, 16 Mar 2026 at 21:15, Antonin Houska wrote: > = > > > Anyway (fortunately?), the concurrent use of slots by REPACK is limi= ted > > > because, during the initialization of logical decoding, the backend = needs to > > > wait for all the transactions having XID assigned to finish, and the= se include > > > the already running REPACK commands. See SnapBuildWaitSnapshot() and= callers > > > if you're interested in details. > > = > > Huh, so would you be able to run more than one Repack Concurrently in > > the same database? ISTM that would not be possible, apart from > > possibly a mechanism comparable to the SAFE_IN_IC flag (to not wait on > > those backends). > = > Yeah, this sounds kind of bad news ... Admittedly, it is a problem. I tried to address this in pg_squeeze by pre-allocating slots when it's clear (due to scheduling) that more than on= e table needs to be processed. This was an effort to achieve the best possib= le performance rather than a response to complaints of users about low throughput. Nevertheless, I'm glad I happened to mention it before it's to= o late. Regarding solution, a flag like SAFE_IN_IC alone does not help. The information that particular transaction is used by REPACK (and therefore i= t does not have to be decoded) would need to be propagated to the xl_running_xacts WAL record too. The enhancements I wrote for PG 20 (not all of them posted yet) that aim a= t eliminating the impact of REPACK on VACUUM xmin horizon should fix this problem: due to the MVCC-safety (i.e. preserving xmin/xmax of the tuples), REPACK will not need XID assigned (except for catalog changes, which will happen in separate transactions), so it won't block the logical decoding s= etup of other backends. So the question is whether we should implement a workaround for PG 19, tha= t won't be needed in v20. -- = Antonin Houska Web: https://www.cybertec-postgresql.com