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 1w9iZX-001gB0-0n for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 11:56:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9iZV-008CtJ-28 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 11:56:50 +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.96) (envelope-from ) id 1w9iZV-008CtA-1A for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 11:56:49 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9iZT-00000000tSg-2J71 for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 11:56:49 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-38e01b8ef3eso6232021fa.2 for ; Mon, 06 Apr 2026 04:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775476607; cv=none; d=google.com; s=arc-20240605; b=XIIIMuUSXDWYsys4ZEE9L9xPc1SJatDbHXzRANvMTKaiMmh24fdF4zC+zKCL4/QcYn YxbdqPRO+kGXkHZsoLju5AZ9L1TGqfF3iWbT3jRKvuCA/Z/GcL70KTSoRd5H8VkCBx/C 4E4cmaBYDXlWB+Q5zuSQpoTsC5TzSvcbLUxyDdW1/RSZOFrygMYiSc1MgA9gt9RolgoZ mlgMLcZj5jd9rE/vcA1DdHFwQB/lCsP2dPEtjRUAcTHMGhUUhyV41NncDGBXwENxiksj fpDq8nienXWSYMF02kd1heWUX8TGuVbx1w72HJdKjNSeDp/4QLRAW1hrN0UMZgL7szhT jM7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PvxmTgm9R/hUGJXup43YE15F7hrFDRc06mcyp/ZU9TE=; fh=7zoE8WcvsBBNkhobIJ76I8FjGQ/Sq2wgiHW/TN5o7LM=; b=Ab9jlq7RaD2yCjAEhTvaKwP75w5E8z8rYOBakUt3setf1mITBJGNJr5ZRkhefABFxg e1dylupx5GxRSETcAMVJYdUMDy+FhE2kjMokvP+7TnfRnPF5ugkF4eFFQONyfpFTc0TO zRNhHu6OBN3HNQ4FO840EoEviHkypafHDy1QLSQYg5tEZ+BmzVyj5GEee5Z4pinZjaiO 6UfLevLuY3JZ6NAg6FcdvgtzjaO6b8QhOUpHkbvBxGdtVTWfENsy1GIfgXJGcJnaiqIm usq12THw/QOMOmQwIxCJNgEDmnV3lr/Nx7JryJ5L6OKBw7HsxOsORvndduCtBAf1SdLF HqmA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775476607; x=1776081407; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PvxmTgm9R/hUGJXup43YE15F7hrFDRc06mcyp/ZU9TE=; b=ZYrVQC1kKUzqXw8wg8I7asUg3+o6kMMQqUeqPEuCZ9SADH1UTa61bIrehHv9TylsCi 9OaZdjKqFy9/AKN8rxNfNscJPEzBNK7/xjoZgv3VFhHq7e9W3NRt7SpZ7976Ge1rwKbb dah+hCGGLRvweXrdcBYDmPpBxgPoBNKOQ331c2z/IbRNXd2DdzHdStUsV6YHxjktF/kO fiJowmzsJUZoB3Ne1D7e7s/gfc0hAHSMJrxDLAgyUEeMKyTp6U43fwy91vY8qEeKDYWL GZN14xAfLp/bAGauNHvydMUHyZ/cHYfApFcot1oWu9BznClxm4NVnepwkhL2Xohu4eop 9HqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775476607; x=1776081407; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PvxmTgm9R/hUGJXup43YE15F7hrFDRc06mcyp/ZU9TE=; b=Ir2fpLRDJiseBE1bWze6b3ZJ8ZDeb+ocAMGPzEaUP6AkR0wAC4J985FFAjXuaB4nvE d6OKwFw9zi6uaCjXrCt899w4+CgUlhLdax7Y2vy8tvjmiC+g6aISSQSwo2s3/gJf+LnE UuGo+4PhciZ08dkF/DGu6IekSiNXiKTnObOJfcybfVCXxQotAvaC104W80D+hyIDdyuy tjGl6UdZbDY4hCliEDdci+BPM8A3rTd3IVdw3X0vTalFBsZMfiqgUzIBtlw2p2inB+Zz ntGpMRNIxiPfebe3xRS67DiTnPFNcSo01LcXKZeJSdaoTrfo/ZOTTJvOERmGLdwxM+K9 XWFw== X-Forwarded-Encrypted: i=1; AJvYcCU2zpT0suwVSNqeFIZxf/W4ydhLPX4icM6HjV0StaGfKX6JDnEo8nc553MCIv9GAxu5D37jyxEwz6RfFFWu@lists.postgresql.org X-Gm-Message-State: AOJu0YxHW4vAfrSYyd+gHxrxGGxvUVQ8qsXyiu3PPgyz4smKI5pFTx9T fwP6DuvUUmU7xlepacbMHeVmw06ZuOO3rFWQ9zZpWmeDAa7OEoC5HZZAt2BXp1o7r6m7SCBaeKz KUU9bTPfLk8qncesQfY2EF1HHqcLipAs= X-Gm-Gg: AeBDieuB19BMmJtUhQFcdw3MnBJ/z96LfqSB6HPgA85WPKAj/7luci7ZTVRMUsa74eA L5FT/4Jn3w5Keru1bwG2a7cgoXEVpytQpkAiwMsrOnnlKk2isiXFeW+Q1yQAaycIwg4/0+UGAOB EIIDCyqNSXwdB/gs2P6/z2QtuwBQqpI7L7GYm6R6TEIiuGuWHyNdIAP8FZUS1KveDzrHXDP71v+ YwpxJ9hMM7duGlip03wATV8y2FGuipbMFmphrx09y+xGaPOVaZy53yjp7pzU9cjNc6w/cmpiH+G 3jtCLD54TF17NTgtt1MaC05mpBI2K9XVfY5L5/Es7Q== X-Received: by 2002:a2e:b8cd:0:b0:38b:dbcf:a29f with SMTP id 38308e7fff4ca-38d91c16a1fmr34537781fa.28.1775476606554; Mon, 06 Apr 2026 04:56:46 -0700 (PDT) MIME-Version: 1.0 References: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> In-Reply-To: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> From: Amit Kapila Date: Mon, 6 Apr 2026 17:26:33 +0530 X-Gm-Features: AQROBzDiqk_5bNltmBqMG992j0nCHmUn1k08NVGV2Fgg-DFkzZjisT7NDHH-vn4 Message-ID: Subject: Re: Adding REPACK [concurrently] To: Alvaro Herrera Cc: vignesh C , Antonin Houska , Srinath Reddy Sadipiralla , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 6, 2026 at 3:08=E2=80=AFPM Alvaro Herrera wrote: > > On 2026-Apr-06, vignesh C wrote: > > > On Mon, 6 Apr 2026 at 02:12, Alvaro Herrera w= rote: > > > Few comments: > > Thanks for reviewing this patch! > > > 1) Can we add a comment why we should error out here, as repack > > concurrently requires this whereas repack does not require this check. > > Even if it is required for decoding can't it be handled by replica > > identity full: > > + /* > > + * If the identity index is not set due to replica identity bei= ng, PK > > + * might exist. > > + */ > > + ident_idx =3D RelationGetReplicaIndex(rel); > > + if (!OidIsValid(ident_idx) && OidIsValid(rel->rd_pkindex)) > > + ident_idx =3D rel->rd_pkindex; > > + if (!OidIsValid(ident_idx)) > > + ereport(ERROR, > > + > > errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > > + errmsg("cannot process relation \"%s\""= , > > + RelationGetRelationName(rel)= ), > > + errhint("Relation \"%s\" has no > > identity index.", > > + RelationGetRelationName= (rel))); > > Ah, I was just rewriting that comment moments ago. I think we could > make it work with replica identity full in theory, but I'm guessing it > would be useless. You really need an index that lets you locate the > affected tuples; otherwise the replay would take forever. If the table > is big, that would make the whole thing unworkable. If the table isn't > big, then you can probably just use straight repack without too much > disruption. > > /* > * Obtain the replica identity index -- either one that has been = set > * explicitly, or the primary key. If none of these cases apply,= the > * table cannot be repacked concurrently. It might be possible t= o have > * repack work with a FULL replica identity; however that require= s more > * work and is not implemented yet. > */ > > Now, it's possible to have a non-unique index on some columns (not good > enough to be replica identity) which gives you a list of candidate > tuples, and then the implementation chooses one based on the other > columns which are present in the FULL replica identity. (This seems a > bit dangerous, because there might be multiple matching tuples; and how > do you choose?) Now let's further suppose you can narrow down to a > single tuple; in that case, using FULL would work. > I think this is already working for apply worker where we compare tuples if the index is non_uniuqe, see FindReplTupleInLocalRel. > However, as I said, > this requires more implementation effort. We could entertain a patch > for this during the pg20 cycle, though I'm doubtful that it would really > be worth your while. > It is fine to support it later in pg20. In general, I wonder if we have evaluated whether some of the apply-worker infrastructure could have been reused here? --=20 With Regards, Amit Kapila.