pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: sub-select with aggregate
Date: Thu, 24 Oct 2002 16:32:18 -0400
Message-ID: <14322.1035491538@sss.pgh.pa.us> (raw)
In-Reply-To: <20021024093022.A21018-100000@megazone23.bigpanda.com>
References: <20021024093022.A21018-100000@megazone23.bigpanda.com>

Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> 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.

We have talked about adding code to make that deduction.  The issue is
how to do so without expending a lot of cycles (that will be wasted in
every query where no improvement results, which is most of them).  There
are also some ticklish issues about side-effects of adding such clauses.
in the above example, if we did filter b with b.a=3, then the join
clause a.a=b.a becomes a no-op and does not reduce the number of rows;
if we fail to account for that fact we will underestimate the number of
rows out of the join, possibly pessimizing higher levels of plan.  Also,
we might as well implement the join as a nestloop; no percentage in
fooling with hash or merge overhead.

I have some thoughts about this, but it's not happening for 7.3 ...

			regards, tom lane



view thread (17+ messages)  latest in thread

Message-ID: <14322.1035491538@sss.pgh.pa.us>
Permalink:  ../14322.1035491538@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14322.1035491538@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, sszabo@megazone23.bigpanda.com, jasiek@klaster.net
  Subject: Re: sub-select with aggregate
  In-Reply-To: <14322.1035491538@sss.pgh.pa.us>

* 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