Re: [GENERAL] Simulating an outer join - Mailing list pgsql-general

From Bruce Momjian
Subject Re: [GENERAL] Simulating an outer join
Date
Msg-id 200001122100.QAA14618@candle.pha.pa.us
Whole thread Raw
In response to Re: [GENERAL] Simulating an outer join  (Sarah Officer <officers@aries.tucson.saic.com>)
List pgsql-general
> Can somebody comment on using EXISTS vs. IN in a subselect?  I have
> some statements with subselects, and I'd like to understand the
> ramifications of choosing EXISTS or IN.

We have some brain-damaged code that is faster with EXISTS than IN.
With IN, the subquery is evaluated and the result put in a temp
relation.  Every test for IN sequentially scans the subquery result
looking for a match.  EXISTS uses an index on the subquery result. Not
sure why we can't just fix this, but I don't understand enough to know
the reason.  People who do understand say there is no good solution
until we redesign the query tree in 7.1.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Simulating an outer join
Next
From: "Arthur M. Kang"
Date:
Subject: Stumped. Somebody Help me please!