Not sure if this helps but we've found by turning on "hash_join" the performance of a self join of inserted table is substantially quicker.
Hash joins are turned off in our sever (15.7 SP11) and it seems to be the default
name currentsetting defaultsetting
hash_join 0 0
Is this because our optgoal is set to "allrows_oltp" ?
Incidently the manual says, we set the optgoal rather than use "set hash_join" but we get the message.
SET PLAN OPTGOAL command not allowed within a trigger.
Why is this ?