pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: non-bulk inserts and tuple routing
Date: Thu, 08 Feb 2018 19:16:04 +0900
Message-ID: <5A7C2364.9040700@lab.ntt.co.jp> (raw)
In-Reply-To: <5A7AD6B5.3020304@lab.ntt.co.jp>
References: <8975331d-d961-cbdd-f862-fdd3d97dc2d0@lab.ntt.co.jp>
	<f3a0d60e-1f60-f2ea-dd6e-89c397e4ecf4@lab.ntt.co.jp>
	<CA+TgmoZM7S8cakW4j4b5xOz=p3ZOaMJTK-zd8ca8Gh9gY-17Tw@mail.gmail.com>
	<56c9f77b-830c-4652-233e-a1c5fa5a9938@lab.ntt.co.jp>
	<8f53a342-e0df-4fc9-7422-c3c3c601117c@lab.ntt.co.jp>
	<5A69A3B7.10403@lab.ntt.co.jp>
	<37f7cc10-def8-b2d0-615d-dfe035e7b1ee@lab.ntt.co.jp>
	<5A70396A.8090400@lab.ntt.co.jp>
	<8399fd28-07c2-3cbc-f807-f89cdf2f98f5@lab.ntt.co.jp>
	<5A704055.40207@lab.ntt.co.jp>
	<5A7443DF.1010408@lab.ntt.co.jp>
	<14870d0e-d9d4-2ab9-ddfe-182b3c8abfca@lab.ntt.co.jp>
	<5A783549.4020409@lab.ntt.co.jp>
	<5A7AD6B5.3020304@lab.ntt.co.jp>

(2018/02/07 19:36), Etsuro Fujita wrote:
> (2018/02/05 19:43), Etsuro Fujita wrote:
>> (2018/02/05 14:34), Amit Langote wrote:
>>> Here is the updated version that contains two patches as described
>>> above.

Here are some minor comments:

o On changes to ExecInsert

* This might be just my taste, but I think it would be better to (1) 
change ExecInitPartitionInfo so that it creates and returns a 
newly-initialized ResultRelInfo for an initialized partition, and (2) 
rewrite this bit:

+       /* Initialize partition info, if not done already. */
+       ExecInitPartitionInfo(mtstate, resultRelInfo, proute, estate,
+                             leaf_part_index);
+
         /*
          * Save the old ResultRelInfo and switch to the one 
corresponding to
          * the selected partition.
          */
         saved_resultRelInfo = resultRelInfo;
         resultRelInfo = proute->partitions[leaf_part_index];
+       Assert(resultRelInfo != NULL);

to something like this (I would say the same thing to the copy.c changes):

     /*
      * Save the old ResultRelInfo and switch to the one corresponding to
      * the selected partition.
      */
     saved_resultRelInfo = resultRelInfo;
     resultRelInfo = proute->partitions[leaf_part_index];
     if (resultRelInfo == NULL);
     {
         /* Initialize partition info. */
         resultRelInfo = ExecInitPartitionInfo(mtstate,
                                               saved_resultRelInfo,
                                               proute,
                                               estate,
                                               leaf_part_index);
     }

This would make ExecInitPartitionInfo more simple because it can assume 
that the given partition has not been initialized yet.

o On changes to execPartition.h

* Please add a brief decsription about partition_oids to the comments 
for this struct.

@@ -91,6 +91,7 @@ typedef struct PartitionTupleRouting
  {
     PartitionDispatch *partition_dispatch_info;
     int         num_dispatch;
+   Oid        *partition_oids;

That's it.

Best regards,
Etsuro Fujita




view thread (43+ messages)  latest in thread

Message-ID: <5A7C2364.9040700@lab.ntt.co.jp>
Permalink:  ../5A7C2364.9040700@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/5A7C2364.9040700@lab.ntt.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: fujita.etsuro@lab.ntt.co.jp, Langote_Amit_f8@lab.ntt.co.jp, pgsql-hackers@lists.postgresql.org
  Subject: Re: non-bulk inserts and tuple routing
  In-Reply-To: <5A7C2364.9040700@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox