Re: Freeze the inserted tuples during CTAS?

From: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>
To: Paul Guo <guopa(at)vmware(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Freeze the inserted tuples during CTAS?
Date: 2021-01-27 09:33:29
Message-ID: CAC8Q8t+ZNxc9ijeF8+7C2wy5R3RbcUNHYtxDve+njof7QxWt-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I confirm that my analytic workflows often do the CTAS and VACUUM of the
relation right after, before the index creation, to mark stuff as
all-visible for IOS to work. Freezing and marking as visible will help.

On Wed, Jan 27, 2021 at 12:29 PM Paul Guo <guopa(at)vmware(dot)com> wrote:

> Here is the simple patch,
>
> diff --git a/src/backend/commands/createas.c
> b/src/backend/commands/createas.c
> index dce882012e..0391699423 100644
> --- a/src/backend/commands/createas.c
> +++ b/src/backend/commands/createas.c
> @@ -552,7 +552,7 @@ intorel_startup(DestReceiver *self, int operation,
> TupleDesc typeinfo)
> myState->rel = intoRelationDesc;
> myState->reladdr = intoRelationAddr;
> myState->output_cid = GetCurrentCommandId(true);
> - myState->ti_options = TABLE_INSERT_SKIP_FSM;
> + myState->ti_options = TABLE_INSERT_SKIP_FSM | TABLE_INSERT_FROZEN;
>
> MatView code already does this and COPY does this if specified. I’m not
> sure how
> does the community think about this. Actually personally I expect more
> about the
> all-visible setting due to TABLE_INSERT_FROZEN since I could easier use
> index only scan
> if we create an index and table use CTAS, else people have to use index
> only scan
> after vacuum. If people do not expect freeze could we at least introduce a
> option to
> specify the visibility during inserting?
>
> Regards,
> Paul

--
Darafei "Komяpa" Praliaskouski
OSM BY Team - http://openstreetmap.by/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-01-27 09:46:31 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax
Previous Message Amit Kapila 2021-01-27 09:30:56 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax