Re: [GENERAL] Simulating an outer join

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Sarah Officer <officers(at)aries(dot)tucson(dot)saic(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] Simulating an outer join
Date: 2000-01-12 21:00:40
Message-ID: 200001122100.QAA14618@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arthur M. Kang 2000-01-12 22:07:55 Stumped. Somebody Help me please!
Previous Message Bruce Momjian 2000-01-12 20:55:57 Re: [GENERAL] Simulating an outer join