Re: should INSERT SELECT use a BulkInsertState?

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Luc Vlaming <luc(at)swarm64(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: should INSERT SELECT use a BulkInsertState?
Date: 2020-12-05 19:59:41
Message-ID: 20201205195941.GH24052@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 03, 2020 at 10:59:34AM +0530, Bharath Rupireddy wrote:
> On Wed, Dec 2, 2020 at 10:24 PM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> >
> > One loose end in this patch is how to check for volatile default expressions.
>
> I think we should be doing all the necessary checks in the planner and
> have a flag in the planned stmt to indicate whether to go with multi
> insert or not. For the required checks, we can have a look at how the
> existing COPY decides to go with either CIM_MULTI or CIM_SINGLE.

Yes, you can see that I've copied the checks from copy.
Like copy, some checks are done once, in ExecInitModifyTable, outside of the
ExecModifyTable "loop".

This squishes some commits together.
And uses bistate for ON CONFLICT.
And attempts to use memory context for tuple size.

For the bufferedBytes check, I'm not sure what's best. Copy flushes buffers
after 65k of input line length, but that's totally different from tuple slot
memory context size, which is what I used for insert. Maybe COPY should also
use slot size? Or maybe the threshold to flush needs to be set in miinfo,
rather than a #define, and differ between COPY and INSERT.

--
Justin

Attachment Content-Type Size
v8-0001-INSERT-SELECT-to-use-BulkInsertState-and-multi_in.patch text/x-diff 46.9 KB
v8-0002-WIP-Check-for-volatile-defaults.patch text/x-diff 7.3 KB
v8-0003-COPY-flush-multi-insert-buffer-based-on-accumulat.patch text/x-diff 1.7 KB
v8-0004-WIP-check-tuple-size.patch text/x-diff 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2020-12-05 20:27:08 Re: Index Skip Scan (new UniqueKeys)
Previous Message Heikki Linnakangas 2020-12-05 18:40:33 Re: [PATCH] Keeps tracking the uniqueness with UniqueKey