From: | "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com> |
---|---|
To: | "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Avoid CommandCounterIncrement in RI trigger when INSERT INTO referencing table |
Date: | 2021-03-10 02:24:58 |
Message-ID: | OS0PR01MB5716DC739E36616EBDEA050294919@OS0PR01MB5716.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Attaching the first version patch which avoid CCI in RI trigger when insert into
> referencing table.
After some more on how to support parallel insert into fk relation.
It seems we do not have a cheap way to implement this feature.
Please see the explanation below:
In RI_FKey_check, Currently, postgres execute "select xx for key share" to check that foreign key exists in PK table.
However "select for update/share" is considered as parallel unsafe. It may be dangerous to do this in parallel mode, we may want to change this.
And also, "select for update/share" is considered as "not read only" which will force readonly = false in _SPI_execute_plan.
So, it seems we have to completely change the implementation of RI_FKey_check.
At the same time, " simplifying foreign key/RI checks " thread is trying to replace "select xx for key share" with index_beginscan()+table_tuple_lock() (I think it’s parallel safe).
May be we can try to support parallel insert fk relation after " simplifying foreign key/RI checks " patch applied ?
Best regards,
houzj
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2021-03-10 03:10:39 | Re: shared-memory based stats collector |
Previous Message | Amit Kapila | 2021-03-10 02:17:54 | pgsql: Enable parallel SELECT for "INSERT INTO ... SELECT ...". |