Re: To use a VIEW or not to use a View..... - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: To use a VIEW or not to use a View.....
Date
Msg-id 20030122164324.K4204-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: To use a VIEW or not to use a View.....  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: To use a VIEW or not to use a View.....  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
On Wed, 22 Jan 2003, Tom Lane wrote:

> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:

> > The filter is applied only to a.  So, if you really wanted the
> > c.a=3 condition to be applied for whatever reason you're out of
> > luck.
>
> FWIW, CVS tip is brighter: the condition does propagate to both relations.
>
>  Hash Join  (cost=22.51..45.04 rows=1 width=8)
>    Hash Cond: ("outer".a = "inner".a)
>    ->  Seq Scan on a  (cost=0.00..22.50 rows=5 width=4)
>          Filter: (a = 3)
>    ->  Hash  (cost=22.50..22.50 rows=5 width=4)
>          ->  Seq Scan on c  (cost=0.00..22.50 rows=5 width=4)
>                Filter: (3 = a)
>
> The reason this is useful is that (a) fewer rows need to be joined,
> and (b) we may be able to make effective use of indexes on both tables.

Yeah.  I was going to ask how hard you thought it would be to do for
this particular sort of case.  I thought about the simple case of using
and realized it'd probably be reasonable in amount of work, but it seems
I don't have to think about it. :)




pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: To use a VIEW or not to use a View.....
Next
From: Stephan Szabo
Date:
Subject: Re: To use a VIEW or not to use a View.....