Re: No optimization with a partition window in a view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pinaraf(at)pinaraf(dot)info, pgsql-bugs(at)postgresql(dot)org
Subject: Re: No optimization with a partition window in a view
Date: 2014-02-18 04:10:53
Message-ID: 14142.1392696653@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Joshua Yanovski 2014-02-18 05:33:58 Re: BUG #9227: Error on SELECT ROW OVERLAPS ROW with single ROW argument
Previous Message Kyotaro HORIGUCHI 2014-02-18 02:50:22 Re: No optimization with a partition window in a view