On Wed, Feb 24, 2021 at 3:12 PM Amit Kapila <[email protected]> wrote: > > On Wed, Feb 24, 2021 at 8:41 AM Greg Nancarrow <[email protected]> wrote: > > > > On Tue, Feb 23, 2021 at 10:53 PM Amit Kapila <[email protected]> > > wrote: > > > > > > > But the non-parallel plan was chosen (instead of a parallel plan) > > > > because of parallel-safety checks on the partitions, which found > > > > attributes of the partitions which weren't parallel-safe. > > > > So it's not so clear to me that the dependency doesn't exist - the > > > > non-parallel plan does in fact depend on the state of the partitions. > > > > > > > > > > Hmm, I think that is not what we can consider as a dependency. > > > > > > > Then if it's not a dependency, then we shouldn't have to check the > > attributes of the partitions for parallel-safety, to determine whether > > we must use a non-parallel plan (or can use a parallel plan). > > Except, of course, we do have to ... > > > > I don't think the plan-dependency and checking for parallel-safety are > directly related. >
That is certainly not my understanding. Why do you think that they are not directly related? This whole issue came about because Amit L pointed out that there is a need to add partition OIDs as plan-dependencies BECAUSE the checking for parallel-safety and plan-dependency are related - since now, for Parallel INSERT, we're executing extra parallel-safety checks that check partition properties, so the resultant plan is dependent on the partitions and their properties. Amit L originally explained this as follows: "I think that the concerns raised by Tsunakawa-san in: https://www.postgresql.org/message-id/TYAPR01MB2990CCB6E24B10D35D28B949FEA30%40TYAPR01MB2990.jpnprd01.prod.outlook.com regarding how this interacts with plancache.c deserve a look. Specifically, a plan that uses parallel insert may fail to be invalidated when partitions are altered directly (that is without altering their root parent). That would be because we are not adding partition OIDs to PlannerGlobal.invalItems despite making a plan that's based on checking their properties." Tsunakawa-san: "Is the cached query plan invalidated when some alteration is done to change the parallel safety, such as adding a trigger with a parallel-unsafe trigger action?" Regards, Greg Nancarrow Fujitsu Australia
