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