Re: Strange result with LATERAL query

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Strange result with LATERAL query
Date: 2016-08-24 15:29:16
Message-ID: 87oa4ib36h.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> I'm not sure if it's worth trying to distinguish whether the Param
Tom> is inside any aggregate calls or not. The existing code gets the
Tom> right answer for

Tom> select array(select x+sum(y) from generate_series(1,3) y group by y)
Tom> from generate_series(1,3) x;

Tom> and we'd be losing some efficiency for cases like that if we fix
Tom> it as above. But is it worth the trouble?

The loss of efficiency could be significant, since it's forcing a rescan
of what could be an expensive plan.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2016-08-24 15:46:50 Re: Strange result with LATERAL query
Previous Message Pavel Stehule 2016-08-24 15:26:04 Re: Strange result with LATERAL query