Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKrto-0005x6-UQ for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 17:45:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKrto-0000ga-GR for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Jul 2015 17:45:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKrtB-0008Jy-5V for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 17:45:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKrt7-00049M-V0 for pgsql-bugs@postgresql.org; Thu, 30 Jul 2015 17:45:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t6UHiwnn028692; Thu, 30 Jul 2015 13:44:58 -0400 From: Tom Lane To: Marko Tiikkaja cc: Maxim Boguk , pgsql-bugs Subject: Re: BUG #13528: LATERAL vs. correlated scalar subquery In-reply-to: <55BA178F.9050503@joh.to> References: <20150730085352.9098.47740@wrigleys.postgresql.org> <55BA178F.9050503@joh.to> Comments: In-reply-to Marko Tiikkaja message dated "Thu, 30 Jul 2015 14:24:47 +0200" Date: Thu, 30 Jul 2015 13:44:58 -0400 Message-ID: <28691.1438278298@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Marko Tiikkaja 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs