Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFc1O-0000z7-9D for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2014 04:11:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WFc1N-0002Lo-Jw for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2014 04:11:01 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFc1M-0002Lh-Fy for pgsql-bugs@postgresql.org; Tue, 18 Feb 2014 04:11:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFc1K-00041F-4M for pgsql-bugs@postgresql.org; Tue, 18 Feb 2014 04:10:59 +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 s1I4Ar0q014143; Mon, 17 Feb 2014 23:10:53 -0500 From: Tom Lane To: Kyotaro HORIGUCHI cc: pinaraf@pinaraf.info, pgsql-bugs@postgresql.org Subject: Re: No optimization with a partition window in a view In-reply-to: <20140218.115022.08614214.horiguchi.kyotaro@lab.ntt.co.jp> References: <6539554.0HoVISsQxY@peanuts2> <20140218.115022.08614214.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Tue, 18 Feb 2014 11:50:22 +0900" Date: Mon, 17 Feb 2014 23:10:53 -0500 Message-ID: <14142.1392696653@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) 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 Kyotaro HORIGUCHI writes: > Hello, this seems to be a matter of subquery pushdown, query > transform involving subqueries or how to deal with views in > planner, rather than a bug. In general, pushing a WHERE clause down through a window function call *would* be a bug. I think it should be safe in this case because the WHERE clause matches the window functions' partition clauses, so that applying the WHERE removes either all or none of the rows of any particular partition. We've not gotten around to that type of refinement in window function planning, yet. It would take some infrastructure that doesn't exist now --- I don't recall that we have any code that tries to make that particular kind of proof. 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