| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Greg Nancarrow <gregn4422(at)gmail(dot)com> |
| Cc: | Amit Langote <amitlangote09(at)gmail(dot)com>, "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)fujitsu(dot)com>, "Tang, Haiying" <tanghy(dot)fnst(at)cn(dot)fujitsu(dot)com> |
| Subject: | Re: Parallel INSERT (INTO ... SELECT ...) |
| Date: | 2021-02-24 09:38:50 |
| Message-ID: | CAA4eK1JSjGYrJPvkNBvu1rsN5h0o8AaOG1+EKptbZx7sX1BFHQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Feb 19, 2021 at 6:56 AM Greg Nancarrow <gregn4422(at)gmail(dot)com> wrote:
>
> Posting a new version of the patches, with the following updates:
>
I am not happy with the below code changes, I think we need a better
way to deal with this.
@@ -313,19 +314,35 @@ standard_planner(Query *parse, const char
*query_string, int cursorOptions,
glob->transientPlan = false;
glob->dependsOnRole = false;
+ if (IsModifySupportedInParallelMode(parse->commandType) &&
+ !parse->hasModifyingCTE)
+ {
+ /*
+ * FIXME
+ * There is a known bug in the query rewriter: re-written queries with
+ * a modifying CTE may not have the "hasModifyingCTE" flag set. When
+ * that bug is fixed, this temporary fix must be removed.
+ *
+ * Note that here we've made a fix for this problem only for a
+ * supported-in-parallel-mode table-modification statement (i.e.
+ * INSERT), but this bug exists for SELECT too.
+ */
+ parse->hasModifyingCTE = query_has_modifying_cte(parse);
+ }
+
I understand that this is an existing bug but I am not happy with this
workaround. I feel it is better to check for modifyingCTE in
max_parallel_hazard_walker. See attached, this is atop
v18-0001-Enable-parallel-SELECT-for-INSERT-INTO-.-SELECT.
--
With Regards,
Amit Kapila.
| Attachment | Content-Type | Size |
|---|---|---|
| fix_modifyingcte_parallel_safety_v1.patch | application/octet-stream | 3.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dilip Kumar | 2021-02-24 09:55:57 | Re: Is Recovery actually paused? |
| Previous Message | Drouvot, Bertrand | 2021-02-24 09:11:44 | Re: [BUG] segfault during delete |