Re: segfault with incremental sort - Mailing list pgsql-bugs

From Amit Kapila
Subject Re: segfault with incremental sort
Date
Msg-id CAA4eK1LKC4q7rp5Pn+8zqXH0XSdDuRgf3xwbQNnBFjMU=hd0AQ@mail.gmail.com
Whole thread Raw
In response to Re: segfault with incremental sort  (James Coleman <jtc331@gmail.com>)
Responses Re: segfault with incremental sort
List pgsql-bugs
On Sat, Nov 21, 2020 at 1:21 AM James Coleman <jtc331@gmail.com> wrote:
>
> On Tue, Nov 3, 2020 at 11:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > 1. The SELECT DISTINCT gives rise to a sort key expression that
> > contains non-parallel-safe SubPlans.  (It's not immediately apparent
> > to me why we don't consider these particular subqueries parallel safe,
> > but they aren't.  Anyway such a situation surely has to be allowed for.)
>
> parallel.sgml says that parallel query is excluded any time we have
> "Plan nodes which reference a correlated SubPlan". That would include
> this query, though I'm not sure why that's actually unsafe. I haven't
> thought much about the general case, but this query itself looks like
> it'd be safe.
>

IIRC, the reason was that for correlated subplans each time we need to
send the param for execution to workers, and for that, we don't have
an implementation yet. Basically, if the param size changes each time
(say for varchar type of params), the amount of memory required would
be different each time. It is not that we can't implement it but I
think we have left it originally because we were not sure of the
number of cases it can benefit and certainly it needs some more work.
I am not following this and related discussions closely but can
explain to me why you think the query/plan you are talking about is
safe with respect to the above hazard?

-- 
With Regards,
Amit Kapila.



pgsql-bugs by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop
Next
From: PG Bug reporting form
Date:
Subject: BUG #16740: Conflicting installations