Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Date: 2019-03-12 07:54:16
Message-ID: CABOikdPzhdUJniWhGiwXH0Ytz2fXLeDromZ3J5eaVf-d507=Dw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 11, 2019 at 1:37 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
wrote:

>
>
> I might be missing something but why do we need to recheck whether
> each pages is all-frozen after insertion? I wonder if we can set
> all-frozen without checking all tuples again in this case.
>

It's possible that the user may have inserted unfrozen rows (via regular
INSERT or COPY without FREEZE option) before inserting frozen rows. So we
can't set the all-visible/all-frozen flag unconditionally. I also find it
safer to do an explicit check to ensure we never accidentally mark a page
as all-frozen. Since the check is performed immediately after the page
becomes full and only once per page, there shouldn't be any additional IO
cost and the check should be quite fast.

Thanks,
Pavan
--
Pavan Deolasee http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2019-03-12 08:09:16 Re: Suggestions on message transfer among backends
Previous Message Mithun Cy 2019-03-12 07:53:51 pg_rewind : feature to rewind promoted standby is broken!