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 1thd58-004ucc-N0 for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Feb 2025 23:20:50 +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 1thd57-005V3N-Dn for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Feb 2025 23:20: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.94.2) (envelope-from ) id 1thd57-005V3F-4K for pgsql-hackers@lists.postgresql.org; Mon, 10 Feb 2025 23:20:49 +0000 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1thd54-0007Yw-0u for pgsql-hackers@postgresql.org; Mon, 10 Feb 2025 23:20:48 +0000 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-8552cc5777fso107166939f.1 for ; Mon, 10 Feb 2025 15:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739229644; x=1739834444; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jYfzinMr5dKbarOhl8lj/OHj5DnH5O75wllPQCUDDFM=; b=NtTUqpFFkjlJnwBWenS4oqKDn2ZvGrz95PUKaQjjWf/ls3wsBreZ5zSvjLQyFoKrd1 vUS/D8wQewcIh8pMlGeE1gwq2UoOzJQP0TuZtg9LxBl/BYqm+ghCyRmaXKwvA+E6r6BL uUt8xDC7rdteuWvY14B7pP3gsKsfxjsqZBK5jtphfj7FAiurPluRqUx8MdL6akpNYhFD hrAP6OtQzin/gv1lJFASZwKc2XVDARcmZsf+qGAZM+b887VBD+YbCHrrfAcvZTRbQ6Wk ggapn4lWd3KbqVgDF2TOIk2lRlMXHW/FUpzjnwkAiNfSGBx9cSM5AYCFhOsB2gEpml6v R8dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739229644; x=1739834444; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jYfzinMr5dKbarOhl8lj/OHj5DnH5O75wllPQCUDDFM=; b=UtDkFcybINqwohdqikjbtjSYBj6cF39Q3O1pz5Y3Dbk7ZWeCFXilAufGaxwbOytDsI pc3QoIAIt9lteLx+bze5YAFr+jTdl7Qe3AZSrjij+WvTTHlKAN1Ga/qI249LaHJTmIhU DZydzF8NAIPhfAMlIYnc9q1DAUmWq0aFVqdPdXT3LevEpj8J95d7x63PkXJQzK+sn6sr wsvpKXlzKk/U3ORt9Ag78Eq9fTr7qkD4Fx7QS9dxA6cUVoyXYmqf6NqVwQmsvbQFxygi K4PD7ppqm7EJiC/79TzYR/7YeJZtGZNfELX+XXeJ4ZYb0bdoCl4B/hBuDSy+FVb5Pmfr d9+g== X-Forwarded-Encrypted: i=1; AJvYcCVGjAI5VUmWIhdZCwvHHylIVhour8VPIHdItRptwslVsgPAsiYp061dax0k7A13mEe/DscfLesLlnxxusnW@postgresql.org X-Gm-Message-State: AOJu0Yw+ne3g/CvgshdHOGN7I74LXGfpTAZW6k33jOHkc08PxLyOhlsI UPFwFD+pNZ9o9FTva2K+zIA+3hRUQPDIWrj4hUHG01yxwtJpyK7t X-Gm-Gg: ASbGncsKJOZx8t8i9ZvHclEz638lNefQ+4e/Vf4v6j3r0BCiX6uKLvru7l4HTYmHQNG kUgbRFuH3BOis3RLiNLGH05ouXlHtrtKB1uLK6uZ/Ins0RPAZQ3U8eXTSMOQoqQCQJH65jVyayS VO7W2FL+chR6iqvdZ3SPqGg/2O8Xv3KQFOv3oCzSkvsGgpnA3NV+PaPdLsyk+0oA9L15kw+iHaa tsRsRAPRmY4MK5GVkiOxwXrmXC/AV/pzjtSiQPMjhuHbkNvGz8cPVfJoQNnAvDV3wBgMw27nBEf pEj3TWJUvtxivphVvrcrHHYBAVVO6e7jdtQnqbR/Mqm4uZyLPRpqXbsytDY/Jk8TW1LJ3OMNFO3 06WUV1w== X-Google-Smtp-Source: AGHT+IGt/snGNQzCsc5JbGvetInHl72iWWkB7r8JwQCdZjtoL+DoUYdkCCRl8sewRro9EPwWeGb8Mw== X-Received: by 2002:a05:6602:15cd:b0:855:371a:ca6e with SMTP id ca18e2360f4ac-855371af229mr421740539f.13.1739229644172; Mon, 10 Feb 2025 15:20:44 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-854f668fc6fsm228651539f.27.2025.02.10.15.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2025 15:20:43 -0800 (PST) Date: Mon, 10 Feb 2025 17:20:41 -0600 From: Nathan Bossart To: Matthias van de Meent Cc: "Burd, Greg" , "pgsql-hackers@postgresql.org" Subject: Re: Expanding HOT updates for expression and partial indexes Message-ID: References: <78574B24-BE0A-42C5-8075-3FA9FA63B8FC@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 10, 2025 at 06:17:42PM +0100, Matthias van de Meent wrote: > I have serious doubts about the viability of any proposal working to > implement PHOT/WARM in PostgreSQL, as they seem to have an inherent > nature of fundamentally breaking the TID lifecycle: > We won't be able to clean up dead-to-everyone TIDs that were > PHOT-updated, because some index Y may still rely on it, and we can't > remove the TID from that same index Y because there is still a live > PHOT/WARM tuple later in the chain whose values for that index haven't > changed since that dead-to-everyone tuple, and thus this PHOT/WARM > tuple is the one pointed to by that index. > For HOT, this isn't much of an issue, because there is just one TID > that's impacted (and it only occupies a single LP slot, with > LP_REDIRECT). However, with PHOT/WARM, you'd relatively easily be able > to fill a page with TIDs (or even full tuples) you can't clean up with > VACUUM until the moment a the PHOT/WARM/HOT chain is broken (due to > UPDATE leaving the page or the final entry getting DELETE-d). > > Unless we are somehow are able to replace the TIDs in indexes from > "intermediate dead PHOT" to "base TID"/"latest TID" (either of which > is probably also problematic for indexes that expect a TID to appear > exactly once in the index at any point in time) I don't think the > system is viable if we maintain only a single data structure to > contain all dead TIDs. If we had a datastore for dead items per index, > that'd be more likely to work, but it also would significantly > increase the memory overhead of vacuuming tables. I share your concerns, but I don't think things are as dire as you suggest. For example, perhaps we put a limit on how long a PHOT chain can be, or maybe we try to detect update patterns that don't work well with PHOT. Another option could be to limit PHOT updates to only when the same set of indexed columns are updated or when <50% of the indexed columns are updated. These aren't fully fleshed-out ideas, of course, but I am at least somewhat optimistic we could find appropriate trade-offs. -- nathan