Re: Volatile Functions in Parallel Plans

2020-07-16 Thread Tom Lane
Jesse Zhang writes: > For more kicks, I don't even think this is restricted to volatile > functions only. To stir the pot, it's conceivable that planner might > produce the following plan > Seq Scan on pg_temp_3.foo > Output: foo.a > Filter: (SubPlan 1) > SubPlan 1 > -> WindowAgg >

Re: Volatile Functions in Parallel Plans

2020-07-16 Thread Jesse Zhang
Hi Tom and Zhenghua, On Thu, Jul 16, 2020 at 8:18 AM Tom Lane wrote: > > Jesse Zhang writes: > > You are right, no they are not consistent. But Neither plans is > > incorrect: > > > 1. In the first query, it's semantically permissible to evaluate > > timeofday() for each pair of (c1, c2), and th

Re: Volatile Functions in Parallel Plans

2020-07-16 Thread Tom Lane
Jesse Zhang writes: > You are right, no they are not consistent. But Neither plans is > incorrect: > 1. In the first query, it's semantically permissible to evaluate > timeofday() for each pair of (c1, c2), and the plan reflects that. > (Notice that the parallel nature of the plan is just noise h

Re: Volatile Functions in Parallel Plans

2020-07-16 Thread Zhenghua Lyu
: Volatile Functions in Parallel Plans Hi Zhenghua, On Wed, Jul 15, 2020 at 5:44 AM Zhenghua Lyu wrote: > > Hi, > I test some SQL in the latest Postgres master branch code (we find these > issues when > developing Greenplum database in the PR > https://nam04.safelinks.protectio

Re: Volatile Functions in Parallel Plans

2020-07-15 Thread Jesse Zhang
Hi Zhenghua, On Wed, Jul 15, 2020 at 5:44 AM Zhenghua Lyu wrote: > > Hi, > I test some SQL in the latest Postgres master branch code (we find these > issues when > developing Greenplum database in the PR > https://github.com/greenplum-db/gpdb/pull/10418, > and my colleague come up with the f

Re: Volatile Functions in Parallel Plans

2020-07-15 Thread Zhenghua Lyu
___ From: Amit Kapila Sent: Thursday, July 16, 2020 12:07 PM To: Zhenghua Lyu Cc: PostgreSQL Hackers Subject: Re: Volatile Functions in Parallel Plans On Wed, Jul 15, 2020 at 6:14 PM Zhenghua Lyu wrote: > > > The first plan: > > Finalize Aggregate >

Re: Volatile Functions in Parallel Plans

2020-07-15 Thread Amit Kapila
On Wed, Jul 15, 2020 at 6:14 PM Zhenghua Lyu wrote: > > > The first plan: > > Finalize Aggregate >-> Gather > Workers Planned: 2 > -> Partial Aggregate >-> Nested Loop > Join Filter: (t3.c1 = t4.c1) > -> Parallel