Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers
Дата
Msg-id CAH2-Wzk6_KBXT3bpJJ5CnwDwdF_-Wm7GhonH-SKBLwjS+zw6nQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers  (James Coleman <jtc331@gmail.com>)
Ответы Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers  (James Coleman <jtc331@gmail.com>)
Список pgsql-hackers
On Fri, Sep 29, 2023 at 11:45 AM James Coleman <jtc331@gmail.com>
wrote:my reading the issue is that "old versions" doesn't say
> anything about "old HOT versions; it seems to be describing what
> happens generally when a heap-only tuple is written -- which would
> include the first time a heap-only tuple is written.

I think that it's talking about what happens during opportunistic
pruning, in particular what happens to HOT chains. (Though pruning
does almost the same amount of useful work with non-heap-only tuples,
so it's a bit unfortunate that the name "HOT pruning" seems to have
stuck.)

> And when it's the
> first heap-only tuple the "old version" would be the original version,
> which would not be a heap-only tuple.

The docs say "Old versions of updated rows can be completely removed
during normal operation". Opportunistic pruning removes dead heap-only
tuples completely, and makes their line pointers LP_UNUSED right away.
But it can also entail removing storage for the original root item
heap tuple, and making its line pointer LP_REDIRECT right away (not
LP_DEAD or LP_UNUSED) at most once in the life of each HOT chain. So
yeah, we're not quite limited to removing storage for heap-only tuples
when pruning a HOT chain. Does that distinction really matter, though?

There isn't even any special case handling for it in pruneheap.c (we
only have assertions that make sure that we're performing "valid
transitions" for each tuple/line pointer). That is, we don't really
care about the difference between calling ItemIdSetRedirect() for an
LP_NORMAL item versus an existing LP_REDIRECT item at the code level
(we just do it and let PageRepairFragmentation() clean things up).

--
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: James Coleman
Дата:
Сообщение: Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Allow deleting enumerated values from an existing enumerated data type