Re: should INSERT SELECT use a BulkInsertState?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: should INSERT SELECT use a BulkInsertState?
Date: 2020-05-11 06:19:34
Message-ID: 20200511061934.GC88791@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 08, 2020 at 02:25:45AM -0500, Justin Pryzby wrote:
> Seems to me it should, at least conditionally. At least if there's a function
> scan or a relation or ..
>
> I mentioned a bit about our use-case here:
> https://www.postgresql.org/message-id/20200219173742.GA30939%40telsasoft.com
> => I'd prefer our loaders to write their own data rather than dirtying large
> fractions of buffer cache and leaving it around for other backends to clean up.

Does it matter in terms of performance and for which cases does it
actually matter?

> diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
> index 4fee043bb2..daf365f181 100644
> --- a/src/include/nodes/execnodes.h
> +++ b/src/include/nodes/execnodes.h
> @@ -14,6 +14,7 @@
> #ifndef EXECNODES_H
> #define EXECNODES_H
>
> +#include "access/heapam.h"
> #include "access/tupconvert.h"
> #include "executor/instrument.h"
> #include "fmgr.h"
> @@ -1177,6 +1178,7 @@ typedef struct ModifyTableState
> List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */
> EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */
> bool fireBSTriggers; /* do we need to fire stmt triggers? */
> + BulkInsertState bistate; /* State for bulk insert like INSERT SELECT */

I think that this needs more thoughts. You are introducing a
dependency between some generic execution-related nodes and heap, a
table AM.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuro Yamada 2020-05-11 06:19:50 Re: PG 13 release notes, first draft
Previous Message Pavel Stehule 2020-05-11 06:07:48 Re: calling procedures is slow and consumes extra much memory against calling function