Re: [HACKERS] Window functions seem to inhibit push-down of quals into views

2010-08-13 Thread Tom Lane
Alvaro Herrera writes: > CREATE TABLE foo AS SELECT a, a % 10 AS b FROM generate_series(1, 10) 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 =

[HACKERS] Window functions seem to inhibit push-down of quals into views

2010-08-13 Thread Alvaro Herrera
Hi, I've got a table and view defined like this: CREATE TABLE foo AS SELECT a, a % 10 AS b FROM generate_series(1, 10) a; CREATE INDEX a_b ON foo (b); CREATE VIEW bar AS SELECT a, b, lead(a, 1) OVER () FROM foo; Now, if I query the table directly instead of going through the view, a WHERE co