pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
HOT update: why must ALL indexes should be update?
3+ messages / 3 participants
[nested] [flat]

* HOT update: why must ALL indexes should be update?
@ 2023-04-21 14:06  Daniel Wu <staywithpin@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Daniel Wu @ 2023-04-21 14:06 UTC (permalink / raw)
  To: pgsql-general

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?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: HOT update: why must ALL indexes should be update?
@ 2023-04-21 14:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Daniel Wu <staywithpin@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2023-04-21 14:19 UTC (permalink / raw)
  To: Daniel Wu <staywithpin@gmail.com>; +Cc: pgsql-general

Daniel Wu <staywithpin@gmail.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.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: HOT update: why must ALL indexes should be update?
@ 2023-04-28 20:08  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2023-04-28 20:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Daniel Wu <staywithpin@gmail.com>; pgsql-general

On Fri, Apr 21, 2023 at 10:19:42AM -0400, Tom Lane wrote:
> Daniel Wu <staywithpin@gmail.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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-04-28 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 14:06 HOT update: why must ALL indexes should be update? Daniel Wu <staywithpin@gmail.com>
2023-04-21 14:19 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-04-28 20:08   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox