pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: sub-select with aggregate
Date: Thu, 24 Oct 2002 09:39:14 -0700 (PDT)
Message-ID: <20021024093022.A21018-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <20021024175129.M3214@klaster.net>

On Thu, 24 Oct 2002, Tomasz Myrta wrote:

> > The system doesn't realize that it can limit the subquery when the only
> > things it has is the join clause and the limiting clause on the other
> > table.  Like Tom's message about the other view, it won't imply that
> > X.foo=12345 from foo=12345 when the exposed foo is B.foo.
>
> Is this what we should expect, or rather a bug?
> The system knows how to join tables, but fails with joining views or
> subselects :-(

It knows how to join them, it doesn't know that it can change the
clauses given to it in order to make it more efficient.

Basically, as I understand it,
 select * from a,b where a.a=b.a and a.a=3;
isn't going to realize that b.a=3 and act as if
you typed that. It may consider an index scan in
a nested loop for a.a=b.a, but that's not quite
the same.





view thread (17+ messages)  latest in thread

Message-ID: <20021024093022.A21018-100000@megazone23.bigpanda.com>
Permalink:  ../20021024093022.A21018-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20021024093022.A21018-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, jasiek@klaster.net
  Subject: Re: sub-select with aggregate
  In-Reply-To: <20021024093022.A21018-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