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 1w5nFO-003dSh-34 for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 16:07: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 1w5nFN-003fNC-0C for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 16:07:49 +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 1w5nFM-003fN4-1Y for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 16:07:49 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w5nFJ-00000001JIm-22Oa for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 16:07:48 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id ECD7F3ED27; Thu, 26 Mar 2026 16:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1774541264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5DZvK7g/OkCoGyxoWbQvv/ZNcSgVlcdNKOIBHNNUYsE=; b=JgaGoCXdryoxcMnAq9Ve5O82VlBwBEkAJzAy6HW7gSur1XQH4wnGkGHHP6VeGVUASSxad4 GcAHJ5N35uikIccPy+ZbyNP5mJjxRyanA6djybq1vyrBPjMYHkQAWZB4eiRuDMduXrom4a 1qRFReXaRkXSsc1EDA2yLjDchCdCVAanhmsU0itsn5QcE7JyN1szaTW9/PXS7WyMKzULZL MwG2oGNgBcxkaQhNc3ZBxzhWJZfW+l1mN7D7x5CuKVYD/SrzY8LttoE0Q2z0ENKuPBrYF6 JMno6n92G5ZyOmYKaODhkCXvhtSB48nqysiyaBL+98QNUSIux4NjgE68clBsrQ== Message-ID: Date: Thu, 26 Mar 2026 17:07:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) To: Melanie Plageman Cc: Andres Freund , Kirill Reshke , Chao Li , Andrey Borodin , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas References: <2be31f17-5405-4de9-8d73-90ebc322f7d8@vondra.me> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: tomas@vondra.me X-GND-Cause: dmFkZTGRy3Qq+n/VIpB8o57eMeRvoNgE1FidK8/D9BPPv9qsY+BjkNH3TquqWEYqdSo3+7if1MwIG6Iwi7GZ7JoFz5JNnDD6zqpOWHztwwfkYCQZmXCiczn36d0oIk74TXlpjMCZKsE4J7rR0BOVMlUHOTGvVNjYk6rqYxLuU1aJfr8dUHR+dOsuXD0gMcn+djczd+Lj6dreAHB7SgHqvDIAJ4OdcFN53q91mukfjk5DRSfD/pGOJp/z0WvEaEaDJDSwVFJt8Z5fJqGGXr/NRboZJWimOW9TvD+YX9OwJkDUjJCbnoPiJamsEqzonzxwPB2a9EFNheV2xIp0tu+24C4FIeBck2BdNMVCu0GHr6NCH64tNucqgUjVJXtDBM/HkK85QxlC5pmmPqW7KH6WMb4PLiK8y7k36GxAuJDkMbaUhFYtkWg543ujDjbrdQuLihofUSdq4rYx/GTs0xI+AbFEz87sHUZPwJOOv0gEimUQcZWsuDweqEvE7DoDcZCKHKzcYdwoda6An8qU7eIgZV1IgFUWIoPs3pktxS9xkJu9YofdZzJoMXgoq/hR/be/+JGvdBMS7cvf9qKL4G4STi5owNyo8x78aamDWr+1Vcd9bOoSiirM9Ie+aC0H0Zu/ojUgc4n70zl2Gc4i2yCW6K/NM6bxh5zGAEm1UWf0DKzSVnKclA X-GND-State: clean X-GND-Score: -100 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/26/26 15:51, Melanie Plageman wrote: > On Wed, Mar 25, 2026 at 7:29 PM Tomas Vondra wrote: >> >>>> - Do we really want to pass two sets of flags to table_beginscan_common? >>>> I realize it's done to ensure "users" don't use internal flags, but >>>> then maybe it'd be better to do that check in the places calling the >>>> _common? Someone adding a new caller can break this in various ways >>>> anyway, e.g. by setting bits in the internal flags, no? >>> >>> Yes, callers of table_beginscan_common() could pass flags they >>> shouldn't in internal_flags. But I was mostly trying to prevent the >>> case where a user picks a flag that overlaps with an internal flag, >>> conditionally passes it as a user flag, and then when they test for it >>> in their AM-specific code, they aren't actually checking if their own >>> flag is set. >> >> Ah, so we expect people to invent their "own" flags, outside what's in >> ScanOptions? Or do I misunderstand how it works? (I admit not reading >> the whole massive thread, as I was only interested in using the flags in >> my own patch.) > > Yes, this isn't really explored in the rest of the thread. I thought > since the flags are threaded all the way through and they can > set/check the flags in the table AM-specific layer, it would make > sense that they could choose flags for their own purposes. They don't > have to wait for consensus on getting a new SO type added. I don't > know if this is a bad idea. However, changing the table AM wrappers > seems more justifiable if we are making them extensible in this way. > No idea. Do we have an example of a TAM actually needing this? If not, I'd probably advise to remove that and keep the patch simpler. My past attempts to future-proof a patch like this rarely worked. If we want to give TAMs the opportunity to define custom flags, do we already do something like that elsewhere? Is there a precedent how to do that? If we allow the TAM to pick arbitrary flag values, it's easy to end up with collisions later (if we add a new internal flag). Maybe there is a way to prevent that? E.g. we could restrict internal flags to 0x0000FFFF, and custom flags to 0xFFFF0000? regards -- Tomas Vondra