RE: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode

From: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Amit Kapila <akapila(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: RE: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode
Date: 2021-03-23 04:27:12
Message-ID: TYAPR01MB299085073EEA19481FB4A86CFE649@TYAPR01MB2990.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> Okay, I can revert this work to avoid that risk but it would be great
> if you can share your thoughts on what alternative design do you have
> in mind, and or how it should be better implemented? Regarding
> performance overhead, it is for partitioned tables with a large number
> of partitions, and that too when the data to insert is not that much
> or there is parallel-unsafe clause on one of the partitions. Now, how
> else can we determine the parallel-safety without checking each of the
> partitions? We do have other partition-related gucs
> (enable_partition*) to avoid the partitions-related overhead so why is
> it so bad to have guc here (maybe the naming of guc/reloption is not
> good)?
>

I'd love to hear even rough ideas from Robert-san. I guess something like...:

* Basically, we can assume or hope that all partitions have the same parallel safety as the root partitioned table. That is, it'd be very rare that child partitions have different indexes, constraints, and triggers. So, we can just check the root table during planning to decide if we want to run parallel processing.

* When the executor opens a target child partition, it checks its parallel safety only once for it. If any target partition turns out to be parallel unsafe, have the parallel leader do the insertion shomehow.

TBH, I don't think the parameter is so ugly. At least, it's not worse than Oracle or SQL Server.

Regards
Takayuki Tsunakawa

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-03-23 04:28:06 pgsql: Add per-index stats information in verbose logs of autovacuum
Previous Message Amit Kapila 2021-03-23 04:20:22 pgsql: Fix dangling pointer reference in stream_cleanup_files.