Alvaro Herrera <alvhe...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers