Re: Lock-free compaction. Why not?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Lock-free compaction. Why not?
Дата
Msg-id 513896.1721528030@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Lock-free compaction. Why not?  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Lock-free compaction. Why not?
Re: Lock-free compaction. Why not?
Список pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
> No resource links, but if you move a tuple to another page then you
> must also adjust the index.  If you have no exclusive lock on the
> table, then you must assume older transactions still need the old
> tuple version, so you need to create another index entry rather than
> re-pointing the existing index entry's ctid to the new tuple version.

The actually tricky part about that is that you have to ensure that
any concurrent scan will see one of the two copies --- not both,
and not neither.  This is fairly hard when the concurrent query
might be using any of several scan methods, and might or might not
have visited the original tuple before you commenced the move.
You can solve it by treating the move more like an UPDATE, that
is the new tuple gets a new XID, but that has its own downsides;
notably that it must block/be blocked by concurrent real UPDATEs.

            regards, tom lane



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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: pg_upgrade and logical replication
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: Provide a pg_truncate_freespacemap function