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 1v3vY3-005iJc-H9 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 12:03:07 +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 1v3vY1-001TQ4-Iz for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 12:03:06 +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 1v3vY1-001TPw-8K for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 12:03:05 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3vXz-0014lw-20 for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 12:03:05 +0000 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-b3ee18913c0so597619566b.3 for ; Wed, 01 Oct 2025 05:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759320182; x=1759924982; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=vXalGSxN/xqQQlHMPLWVySmYdOKKATWH/qlAkLxfbtA=; b=SnIa3F/Bt9X856HDfqjx562qhp+2e4I+/GdRBlNkpsHIwBllKjJCrp1VQdnBj81pkr 4MtC5geuiUXmxLMKSEoDxC/uwhfk1sBH4vviKtmP4asV+K3X7wvb5jN7EBxRjFzwF4nv OyVMTyPVMJaUqXK+ShVcc69RkCTDIsFFwgspEG9/0UQfpdwcuD/IksKgWNtCOWXO/0fd 4FRdR59+r/vheH/Ps8F+2ikVOEpa/L/PuGpuE+upBJbsX0ZgZ2QBtmnHKTybRTRI4Mm8 075Jeh4AjN4oEdchPELhI5s0Ee4o4FadbEmu0agQ//dV+ThDxzJ6eXjW3PezcM4KKuO2 oUFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759320182; x=1759924982; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vXalGSxN/xqQQlHMPLWVySmYdOKKATWH/qlAkLxfbtA=; b=iAwMVPkTAmt+2aQVWLXVQfsf3jbVf5TQvQ92f2ok/3s+mY5vwk4nRCfP6ZS3g98jkl /leUA75MhEUAI4Ln7IVrESD2wgV2oYtYfnoZKK3YSYreNRdhcvnoQJqEyZ73d6isYysb qp9SQ3RjQDaLJ9KlR5/pm1ix0KpKrMCEAlKXcafbQkTa6fmsR2cm6ivTk446Wq9MKpSK lbFZVbtMCXjYkYe/tBGElES3ZCrzbI81eXPsEfA5EPslj9Yt1PO8t+vJTjWh2rbyWsOe TbLuTp57j3p4pU2ZdSRyixaBMDnYvGdZLn0zMrwqOBsY/S2IrFLQ9cICGhMhEQRIJplC PtXg== X-Forwarded-Encrypted: i=1; AJvYcCX+2XkrYR7ZZ0f5EgFtLzBTuHpTl40YLQW0+P0jgutS1BjsQItvpTHPCf2CS7TDrMw3E0kqa8ehhwZIzG5G@lists.postgresql.org X-Gm-Message-State: AOJu0YzQjjsi+1F31R1G1dv1dM2uMD1F8XmKWxEJxM79kwe7d64kD0Mo da2ImjSuXdmGfgl78rOZjsIZWHxBnMuOOvmVhSsOY1vuZr447MgfUOOo46M9vg== X-Gm-Gg: ASbGncs1yUyuXxQGh9bAfu2hMD5DxwGELK87kKIzoxtw4ViawrpD75lJt9kA+BIpNs6 q/sSC7b1R9Rh6h39lSnvvRA70AiEhL/sGtKvsK2ojGbOa6FhuWaR+VCWcixIC3AuewdVZeTzoh+ HcZckLW0dPlocXm7oh62zh1d3Z519PT9S7gAmeIxm9xpVtC2J41M6xTIqQSRK0AQD8BlnJ+1sBr VjTJn6QC3wZ2pd3WWoFOwu4Y3zSnxLidOFdhcTFtYyyXPwKG1NGWeu5tXpb27GL/s4Bkwfx5X0q aVvFhgw41cCXsXSOx2w8rnSwALzUDTiU5Me4TMF6jeYpxywAxiLGsrKwizaHnI5/RMOAiBZdlzY 7IEiZ3ep/m3zA/EM9Z6wSo7GJnvkdmb68xKAPcJ9XsML5BVSEDBHlUOEX/sz4SWxIqPAGsHYwy4 sdbIh88/oRm2x7YzAAk3U4XYlw4/OvSwse9qXhCpI60x/bcyMtRBAqKXWoG0xO/6MU5f87LD0Px HFhERSx1ZEW9pQ= X-Google-Smtp-Source: AGHT+IHh/lcBTxlRHXyeurShgAPG3LkkAzTjkTCZb5dlPm5jnIp8Urm4h5Jfd6yXpEo+71AGSxjIfg== X-Received: by 2002:a17:907:d22:b0:b0c:fdb7:4df5 with SMTP id a640c23a62f3a-b46e30e9310mr390774866b.18.1759320181795; Wed, 01 Oct 2025 05:03:01 -0700 (PDT) Received: from smtpclient.apple (2001-1c04-0681-7700-b92f-1913-bb55-ff37.cable.dynamic.v6.ziggo.nl. [2001:1c04:681:7700:b92f:1913:bb55:ff37]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b3f575aa299sm601582266b.50.2025.10.01.05.03.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Oct 2025 05:03:01 -0700 (PDT) From: Frits Hoogland Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_22EDAA34-D917-46C0-BB1A-6E81E34B1BAA" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.100.1.1.5\)) Subject: Re: The ability of postgres to determine loss of files of the main fork Date: Wed, 1 Oct 2025 14:02:50 +0200 In-Reply-To: <499686.1759250489@sss.pgh.pa.us> Cc: Aleksander Alekseev , pgsql-hackers@lists.postgresql.org To: Tom Lane References: <013D63E2-5D75-492E-85FF-1D5CC0148C82@gmail.com> <499686.1759250489@sss.pgh.pa.us> X-Mailer: Apple Mail (2.3864.100.1.1.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_22EDAA34-D917-46C0-BB1A-6E81E34B1BAA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thank you for your answer Tom, As pointed out in another thread of this topic: using the heapallindexed = option, it is=20 not possible to detect that the table has missing segments and thus = missing data. What it will detect is if the index is missing data that is existing in = the table, it validates table->index. Frits Hoogland > On 30 Sep 2025, at 18:41, Tom Lane wrote: >=20 > Aleksander Alekseev writes: >>> Therefore, I would like to request an enhancement: add an option to >>> verify_heapam() that causes the primary key index to be scanned and = makes >>> sure that all line pointers in the index point to existing tuples. >=20 >> ... IMO there is little value in adding a check for the existence of >> the segments for a single table. And the *real* check will not differ >> much from something like SELECT * FROM my_table, or from making a >> complete backup of the database. >=20 > As Frits mentioned, neither of those actions will really notice if a > table has been truncated via loss of a segment. >=20 > However, I think the requested functionality already exists via > contrib/amcheck (see the heapallindexed option). The user does have > to make a decision which index to check with, but I think that'd be > required anyway --- as you say, there isn't necessarily a primary key. >=20 > regards, tom lane --Apple-Mail=_22EDAA34-D917-46C0-BB1A-6E81E34B1BAA Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Thank you for your answer = Tom,

As pointed out in another thread of this topic: = using the heapallindexed option, it is 
not possible to = detect that the table has missing segments and thus missing = data.
What it will detect is if the index is missing data that = is existing in the table, it = validates
table->index.

Frits = Hoogland




On 30 Sep 2025, at 18:41, Tom = Lane <tgl@sss.pgh.pa.us> wrote:

Aleksander Alekseev = <aleksander@tigerdata.com> writes:
Therefore, I would like to = request an enhancement: add an option to
verify_heapam() that causes = the primary key index to be scanned and makes
sure that all line = pointers in the index point to existing = tuples.

... = IMO there is little value in adding a check for the existence of
the = segments for a single table. And the *real* check will not = differ
much from something like SELECT * FROM my_table, or from = making a
complete backup of the database.

As = Frits mentioned, neither of those actions will really notice if = a
table has been truncated via loss of a segment.

However, I = think the requested functionality already exists via
contrib/amcheck = (see the heapallindexed option).  The user does have
to make a = decision which index to check with, but I think that'd be
required = anyway --- as you say, there isn't necessarily a primary = key.

= = = regards, tom = lane

= --Apple-Mail=_22EDAA34-D917-46C0-BB1A-6E81E34B1BAA--