Re: Batch insert in CTAS/MatView code - Mailing list pgsql-hackers

From Asim R P
Subject Re: Batch insert in CTAS/MatView code
Date
Msg-id CANXE4TejqaxcsSm+0h_9TB0QJh5raa37UnbGxOT6sUhiX-vNGw@mail.gmail.com
Whole thread Raw
In response to Re: Batch insert in CTAS/MatView code  (Paul Guo <pguo@pivotal.io>)
Responses Re: Batch insert in CTAS/MatView code
Re: Batch insert in CTAS/MatView code
List pgsql-hackers



On Mon, Sep 9, 2019 at 4:02 PM Paul Guo <pguo@pivotal.io> wrote:
>
> So in theory
> we should not worry about additional tuple copy overhead now, and then I tried the patch without setting
> multi-insert threshold as attached.
>

I reviewed your patch today.  It looks good overall.  My concern is that the ExecFetchSlotHeapTuple call does not seem appropriate.  In a generic place such as createas.c, we should be using generic tableam API only.  However, I can also see that there is no better alternative.  We need to compute the size of accumulated tuples so far, in order to decide whether to stop accumulating tuples.  There is no convenient way to obtain the length of the tuple, given a slot.  How about making that decision solely based on number of tuples, so that we can avoid ExecFetchSlotHeapTuple call altogether?

The multi insert copy code deals with index tuples also, which I don't see in the patch.  Don't we need to consider populating indexes?

Asim

pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: Index Skip Scan
Next
From: "Jonathan S. Katz"
Date:
Subject: PostgreSQL 12 RC1 Press Release Draft