Re: HOT update: why must ALL indexes should be update?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Wu <staywithpin(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: HOT update: why must ALL indexes should be update?
Date: 2023-04-28 20:08:34
Message-ID: ZEwnwmYgBYx/Aj3r@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 21, 2023 at 10:19:42AM -0400, Tom Lane wrote:
> Daniel Wu <staywithpin(at)gmail(dot)com> writes:
> > We have many indexes on a table. The chance is that any column could be
> > some part of an index. I understand that when an index has a column that is
> > updated, we can't use HOT, because the index entry could point to a totally
> > different row. But if I have 10 indexes, if only 1 index will be updated,
> > why the rest 9 indexes couldn't use HOT update?
>
> Whether it's a HOT update is a property of the table row, not of
> individual indexes.

Right, specifically the item pointer on the heap/table page can't be
reused because _one_ of the indexes needs a new item pointer to point
to. See the later sections of this talk for diagrams:

https://momjian.us/main/presentations/internals.html#mvcc

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Embrace your flaws. They make you human, rather than perfect,
which you will never be.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gautham Raj 2023-04-29 12:28:39 Multiple Postgrest Verisons how to set one version as default.
Previous Message Amit Kapila 2023-04-28 11:41:03 Re: Support logical replication of DDLs