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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Window functions seem to inhibit push-down of quals into views
Date: 2010-08-13 22:14:10
Message-ID: 23170.1281737650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-13 22:38:29 Re: pgsql: Include the backend ID in the relpath of temporary relations.
Previous Message Tom Lane 2010-08-13 22:02:16 Re: WIP partial replication patch