Hi,
Thanks for the review.
> I noticed some things on the first scan through:
>
> Patch 0001:
> 1) Tidy up the comments a bit:
>
> Suggest the following update to part of the comments:
Changed.
> Patch 0002:
> 1) The new max_parallel_hazard_context member "pk_rels" is not being
> set (to
> NIL) in the is_parallel_safe() function, so it will have a junk value
> in that case - though it does look like nothing could reference it
> then (but the issue may be detected by a Valgrind build, as performed by the buildfarm).
Changed.
> 2) Few things to tidy up the patch comments:
Changed.
> 3) In target_rel_trigger_max_parallel_hazard(), you have added a
> variable declaration "int trigtype;" after code, instead of before:
Changed.
Attaching new version patch with these changes.
Also attaching the simple performance test results (insert into table with foreign key):
postgres=# explain (analyze, verbose) insert into fk select a,func_xxx() from data where a%2=0 or a%3 = 0;
workers | serial insert + parallel select | parallel insert | performace gain
-----------+---------------------------------+-----------------+--------
2 workers | 85512.153ms | 61384.957ms | 29%
4 workers | 85436.957ms | 39335.797ms | 54%
-------------data prepare-----------------------------
create table pk(a int primary key,b int);
create table fk(a int references pk,b int);
create table data(a int, b int);
insert into data select * from generate_series(1,10000000,1) t;
insert into pk select generate_series(1,10000000,1);
------------------------------------------------
Best regards,
houzj