RE: Parallel Inserts (WAS: [bug?] Missed parallel safety checks..)

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Parallel Inserts (WAS: [bug?] Missed parallel safety checks..)
Date: 2021-08-06 08:23:09
Message-ID: OS0PR01MB5716AFD3245838B3B47F226294F39@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tues, August 3, 2021 3:40 PM houzj(dot)fnst(at)fujitsu(dot)com <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> Based on the discussion here, I implemented the auto-safety-check feature.
> Since most of the technical discussion happened here,I attatched the patches in
> this thread.
>
> The patches allow users to specify a parallel-safety option for both partitioned
> and non-partitioned relations, and for non-partitioned relations if users didn't
> specify, it would be computed automatically. If the user has specified
> parallel-safety option then we would consider that instead of computing the
> value by ourselves. But for partitioned table, if users didn't specify the parallel
> dml safety, it will treat is as unsafe.
>
> For non-partitioned relations, after computing the parallel-safety of relation
> during the planning, we save it in the relation cache entry and invalidate the
> cached parallel-safety for all relations in relcache for a particular database
> whenever any function's parallel-safety is changed.
>
> To make it possible for user to alter the safety to a not specified value to get the
> automatic safety check, add a new default option(temporarily named 'DEFAULT'
> in addition to safe/unsafe/restricted) about parallel dml safety.
>
> To facilitate users for providing a parallel-safety option, provide a utility
> functionr "pg_get_table_parallel_dml_safety(regclass)" that returns records of
> (objid, classid, parallel_safety) for all parallel unsafe/restricted table-related
> objects from which the table's parallel DML safety is determined.
> This will allow user to identify unsafe objects and if the required user can change
> the parallel safety of required functions and then use the parallel safety option
> for the table.

Update the commit message in patches to make it easier for others to review.

Best regards,
Houzj

Attachment Content-Type Size
v16-0002-Parallel-SELECT-for-INSERT.patch application/octet-stream 9.9 KB
v16-0003-Get-parallel-safety-functions.patch application/octet-stream 31.8 KB
v16-0004-Cache-parallel-dml-safety.patch application/octet-stream 12.2 KB
v16-0005-Regression-test-and-doc-updates.patch application/octet-stream 110.9 KB
v16-0006-Workaround-for-query-rewriter-hasModifyingCTE-bug.patch application/octet-stream 2.2 KB
v16-0001-CREATE-ALTER-TABLE-PARALLEL-DML.patch application/octet-stream 44.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sadhuprasad Patro 2021-08-06 08:26:21 Support reset of Shared objects statistics in "pg_stat_reset" function
Previous Message Kyotaro Horiguchi 2021-08-06 07:41:38 Re: archive status ".ready" files may be created too early