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: pgsql-sql@postgresql.org
Subject: Re: To use a VIEW or not to use a View.....
Date: Thu, 23 Jan 2003 08:53:53 -0800 (PST)
Message-ID: <20030123084900.P12945-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <25948.1043283680@sss.pgh.pa.us>

On Wed, 22 Jan 2003, Tom Lane wrote:

> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > 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.
>
> > 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. :)
>
> It could still use more eyeballs looking at it.  One thing I'm concerned
> about is whether the extra (derived) conditions lead to double-counting
> restrictivity and thus underestimating the number of result rows.  I
> haven't had time to really test that, but I suspect there may be a problem.

I haven't looked at code yet but tried examples like Tomasz's and some
simple ones and have gotten reasonable seeming output for the estimates
given accurate statistics (joining two estimate 3 outputs, getting 8 for
the estimated rows, joining that with another copy getting 50 some odd
where in this case the real would be 81).  Not that I did  a
particularly thorough test.  I hope to get a chance over the next couple
of days to look and run more tests.

Tomasz, if you have the chance, you might want to try CVS and see what it
does for the queries you've been working with.






view thread (23+ messages)  latest in thread

Message-ID: <20030123084900.P12945-100000@megazone23.bigpanda.com>
Permalink:  ../20030123084900.P12945-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030123084900.P12945-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
  Subject: Re: To use a VIEW or not to use a View.....
  In-Reply-To: <20030123084900.P12945-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