From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Ken Benson <Ken(at)infowerks(dot)com> |
Cc: | "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | Re: delete then insert |
Date: | 2020-01-17 22:20:50 |
Message-ID: | CAMkU=1xvW+7-08+OFWu5Wok-AuM23AGUHgprGvqc1QWbyUjqqg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Fri, Jan 17, 2020 at 3:03 PM Ken Benson <Ken(at)infowerks(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | CR20 | 2020-01-20 00:24:40 | Ver. 12.1 successfully installed on Win 10 but having trouble with jdbc jar |
Previous Message | Ken Benson | 2020-01-17 21:53:07 | RE: delete then insert |