Re: delete then insert

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: delete then insert
Дата
Msg-id CAMkU=1xvW+7-08+OFWu5Wok-AuM23AGUHgprGvqc1QWbyUjqqg@mail.gmail.com
обсуждение исходный текст
Ответ на delete then insert  (Ken Benson <Ken@infowerks.com>)
Список pgsql-admin
On Fri, Jan 17, 2020 at 3:03 PM Ken Benson <Ken@infowerks.com> wrote:

 

So – I THINK I know – that when a row is deleted from a table – the row is not actually removed from the table – but, merely marked as deleted, thus becoming a dead tuple.
AUTOVACUUM – takes care of the process of removing these dead tuples.

 

My question. If – an insert occurs to that same table before autovacuum comes along, does that inserted record use a dead tuple? Or – does the insert result in an actual added row?


There is a double indirection.  The index entries point to a specific "line item" within a specific table block.  In that table block, that line item points to an area in that same block for the actual row data.

Once a row has been delete long enough that no currently active snapshot can possibly care about it, anyone can "clean up" the table block so that the "line item" has a flag set to indicate it no longer points to any storage within the block, and that former storage for the row is then available for reuse.  But only a vacuum can make the line item itself available for reuse.

Now if someone other than a vacuum has cleaned up a block, will it advertise the reclaimed space in the freespace map, so that an INSERT can easily find it?  I don't know.

Cheers,

Jeff

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

Предыдущее
От: Ken Benson
Дата:
Сообщение: RE: delete then insert
Следующее
От: CR20
Дата:
Сообщение: Ver. 12.1 successfully installed on Win 10 but having trouble withjdbc jar