Re: Window functions seem to inhibit push-down of quals into views - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Window functions seem to inhibit push-down of quals into views
Date
Msg-id 23170.1281737650@sss.pgh.pa.us
Whole thread Raw
In response to Window functions seem to inhibit push-down of quals into views  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> CREATE TABLE foo AS SELECT a, a % 10 AS b FROM generate_series(1, 100000) a;
> CREATE INDEX a_b ON foo (b);
> CREATE VIEW bar AS SELECT a, b, lead(a, 1) OVER () FROM foo;

> explain select a, b, lead(a, 1) over () from foo where b = 2;
> explain select * from bar where b = 2;

Those are not equivalent queries.  In the first case b=2 is supposed to be
applied before window function evaluation, in the second case not.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: WIP partial replication patch
Next
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Include the backend ID in the relpath of temporary relations.