Re: sub-select with aggregate

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tomasz Myrta <jasiek(at)klaster(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sub-select with aggregate
Date: 2002-10-24 16:39:14
Message-ID: 20021024093022.A21018-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-10-24 20:32:18 Re: sub-select with aggregate
Previous Message Achilleus Mantzios 2002-10-24 16:14:12 Re: redirect query results to my (stdout) screen