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 1uqDy1-001nG3-Bh for pgsql-hackers@arkaria.postgresql.org; Sun, 24 Aug 2025 16:53:18 +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 1uqDy0-003B5T-Ix for pgsql-hackers@arkaria.postgresql.org; Sun, 24 Aug 2025 16:53:17 +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 1uqDy0-003B5L-6l for pgsql-hackers@lists.postgresql.org; Sun, 24 Aug 2025 16:53:16 +0000 Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uqDxy-001Wjt-13 for pgsql-hackers@lists.postgresql.org; Sun, 24 Aug 2025 16:53:15 +0000 Received: by mail-vk1-xa2c.google.com with SMTP id 71dfb90a1353d-53b1736eae2so2905358e0c.1 for ; Sun, 24 Aug 2025 09:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756054394; x=1756659194; 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=gp9ErDd5Sr7fEoo7xrzi0FApK9ZVQHNewfCHlApvThk=; b=SncqrbfM1dHH3lGAomNPBzTbE9FbdEnwdzbsujUHd/UzbdXkHjGsM4NzvW+m1lsudF BOl9W6gl407K4eBUV77ahxhuCTyagBgE4DSOiiz7VB7e7Z0pFI2vaLj0NefeuKkXuT5n QB+xLldAUM4fmKe4YYsIBKg6sE2IbNq9nDUCUYGPnJLVectd9SxXQAcloMenutQ4ZTrU wqkVK7De/vU3WVwBQrImMZ4WlRM3328vJbF+gxyFHq8bl7Fnydc/4D+zAPINbS+TJF+O 15+ntdzUxpHxaIJ7G1GKNauEIUHpos2Tiuo6AXUnfAVASohT9tLsMqa8JIdXrSjoVdhs wXpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756054394; x=1756659194; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gp9ErDd5Sr7fEoo7xrzi0FApK9ZVQHNewfCHlApvThk=; b=h3YDBMSVVqM56Ypn8V9US+1Nxr57ZzTHeGrCV8bz90Bs7RoGbxpmldZEZ5jcG+GvDB QEJMQdEeLJPkj4oQFjmL6eBSb8fpdTeKJbDwY2YzXbd1eVxcNcs2VotGZjQgtjJ+ofa5 /U2Fl6QkfRdbIueZMHmCCix+MJgwNAOrPicSqoIXfgpJy3BYJS+aLuijaSLHWPm8mIP4 a1UwpjzfKktdVUD2sJ+i4gNHFYLdd996hVLxk+4BdR80d/g0FlaMSPljQHDI5IQJZHzS fXgidfmnyqZxgWXUFEYuh9zo+8cdZiPz4ByUeOU8r0/2XvrINCQE08AS14BdpwxarQJe 0A3w== X-Forwarded-Encrypted: i=1; AJvYcCVDDwUdiXU7GTPBuPeF3hqYZcVxxKkgMwVyCHyEswJqbP1efNpg8MmWGpRWMDFT5TMbL7n37b19aD9femia@lists.postgresql.org X-Gm-Message-State: AOJu0YwxBGA8YNoOVgOZn8NFTavcAL/ZKnWgY/Bnp+3E+7HJf5J5nsR+ 99t/yRkdmXDoILv5hWm1kulg+FwKoFCJ+lkXmPaJY++dgdHJBcW6bV29nCVGFvdnd1T8prM+KUl oAg8OfKC7fQ2mugBFiPukSXkEwfJmGog= X-Gm-Gg: ASbGncvlpUi+k55fpSB5apRekNai5noLuQLgVKmw/hr+6K8B9g3lYVa31Cik7jkIwd6 iLVjqd6SZiLweOgcsO36cLbqZiQqJVmuHfXdAQklbJYVCO5wwetqpamp/7Cg0acR5+bjWRIqe+K +MZyAJhiMKjGl66msU/bnUPMSrymOx7+BT5MeqDgntOYEHNg7IpifeLs7NjDQgkFiv8P9zbfbsv qwZOkY= X-Google-Smtp-Source: AGHT+IFGOUMTAa2dkdTpeJF0Dqev/yjbpdXQTzOdLW8iyZQDIm9wEhRcdHJ7a1CCzZE96L8WzDM0/u7T8NpbPmb8LOc= X-Received: by 2002:a05:6122:308e:b0:539:1dd2:22fa with SMTP id 71dfb90a1353d-53c8a2a4aa1mr2594197e0c.1.1756054393517; Sun, 24 Aug 2025 09:53:13 -0700 (PDT) MIME-Version: 1.0 References: <202508091333.qvgvo7ikuezm@alvherre.pgsql> <40729.1755799624@localhost> In-Reply-To: <40729.1755799624@localhost> From: Mihail Nikalayeu Date: Sun, 24 Aug 2025 18:52:00 +0200 X-Gm-Features: Ac12FXwsAeVssh6AVRdDjG9LLE8FYP_5LIdRPDEcY6YYFXinF6gcNWRyYu3CDKU Message-ID: Subject: Re: Adding REPACK [concurrently] To: Antonin Houska Cc: Alvaro Herrera , Fujii Masao , Robert Treat , Pg Hackers 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 Hello, Antonin! > When posting version 12 of the patch [1] I raised a concern that the the = MVCC > safety is too expensive when it comes to logical decoding. Therefore, I > abandoned the concept for now, and v13 [2] uses plain heap_insert(). Once= we > implement the MVCC safety, we simply rewrite the tuple like v12 did - tha= t's > the simplest way to preserve fields like xmin, cmin, ... Thanks for the explanation. I was looking into catalog-related logical decoding features, and it seems like they are clearly overkill for the repack case. We don't need CID tracking or even a snapshot for each commit if we=E2=80= =99re okay with passing xmin/xmax as arguments. What do you think about the following approach for replaying: * use the extracted XID as the value for xmin/xmax. * use SnapshotSelf to find the tuple for update/delete operations. SnapshotSelf seems like a good fit here: * it sees the last "existing" version. * any XID set as xmin/xmax in the repacked version is already committed - so each update/insert is effectively "committed" once written. * it works with multiple updates of the same tuple within a single transaction - SnapshotSelf sees the last version. * all updates are ordered and replayed sequentially - so the last version is always the one we want. If I'm not missing anything, this looks like something worth including in the patch set. If so, I can try implementing a test version. Best regards, Mikhail