pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tomasz Myrta <jasiek@klaster.net>
Cc: Jan Wieck <JanWieck@Yahoo.com>
Cc: Ries van Twisk <ries@jongert.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: To use a VIEW or not to use a View.....
Date: Wed, 22 Jan 2003 16:45:10 -0800 (PST)
Message-ID: <20030122164324.K4204-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <24368.1043271333@sss.pgh.pa.us>


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. :)





view thread (23+ messages)  latest in thread

Message-ID: <20030122164324.K4204-100000@megazone23.bigpanda.com>
Permalink:  ../20030122164324.K4204-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030122164324.K4204-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, tgl@sss.pgh.pa.us, jasiek@klaster.net, JanWieck@Yahoo.com, ries@jongert.nl
  Subject: Re: To use a VIEW or not to use a View.....
  In-Reply-To: <20030122164324.K4204-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox