Re: BUG #13528: LATERAL vs. correlated scalar subquery

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13528: LATERAL vs. correlated scalar subquery
Date: 2015-07-30 17:44:58
Message-ID: 28691.1438278298@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Marko Tiikkaja <marko(at)joh(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter J. Holzer 2015-07-30 21:30:29 Re: Segfault in pg_stat_activity
Previous Message igor 2015-07-30 14:39:21 BUG #13529: Incorrect work UPPER UTF-8, 9.2 was all right