Re: Batch insert in CTAS/MatView code

From: Asim R P <apraveen(at)pivotal(dot)io>
To: Paul Guo <pguo(at)pivotal(dot)io>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Taylor Vesely <tvesely(at)pivotal(dot)io>
Subject: Re: Batch insert in CTAS/MatView code
Date: 2019-09-25 10:39:19
Message-ID: CANXE4TejqaxcsSm+0h_9TB0QJh5raa37UnbGxOT6sUhiX-vNGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 9, 2019 at 4:02 PM Paul Guo <pguo(at)pivotal(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2019-09-25 10:42:23 PostgreSQL 12 RC1 Press Release Draft
Previous Message Dmitry Dolgov 2019-09-25 09:34:22 Re: Index Skip Scan