Re: BUG #13528: LATERAL vs. correlated scalar subquery - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13528: LATERAL vs. correlated scalar subquery
Date
Msg-id 28691.1438278298@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #13528: LATERAL vs. correlated scalar subquery  (Marko Tiikkaja <marko@joh.to>)
List pgsql-bugs
Marko Tiikkaja <marko@joh.to> writes:
> On 7/30/15 1:48 PM, Maxim Boguk wrote:
>> You could see that the new plan have lower total cost than the old plan
>> (​cost=1867.28..1873.03 vs ​cost=0.00..125498.75).
>> I think it's primary reason why it been selected (planner could produce the
>> old plan but new plan wins on the cost basis).

> I'll have to admit I could've put more time into the original report,
> but I don't think that's accurate.

Yeah.  It would be nice if we could produce a more accurate rowcount
estimate for unnest(array[...]); that's something that's been a pain
for Salesforce so I've been considering ways to fix it.  But it's
not the killer problem here.

> which to me suggests that the planner just doesn't realize that it can
> push the condition on counts.a into the view.

It can't.  We'd need parameterized paths for subqueries, which we don't
have (yet).

            regards, tom lane

pgsql-bugs by date:

Previous
From: igor@assystems.lv
Date:
Subject: BUG #13529: Incorrect work UPPER UTF-8, 9.2 was all right
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Segfault in pg_stat_activity