pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedEXISTS Keyword
2+ messages / 2 participants
[nested] [flat]
* EXISTS Keyword
@ 2001-10-04 01:18 cnliou@eurosport.com
2001-10-04 01:59 ` Re: EXISTS Keyword Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: cnliou@eurosport.com @ 2001-10-04 01:18 UTC (permalink / raw)
To: pgsql-sql
Hello!
I vaguely remember that someone said somewhere that
EXISTS runs faster than IN:
SELECT * FROM table1 where field1 EXISTS (SELECT
field4 FROM table2)
However, all I got from version 7.1.3 is:
ERROR: parser: parse error at or near "exists"
While below works:
SELECT * FROM table1 where field1 IN (SELECT field4
FROM table2)
Any key points I have missed?
CN
--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: EXISTS Keyword
2001-10-04 01:18 EXISTS Keyword cnliou@eurosport.com
@ 2001-10-04 01:59 ` Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Momjian @ 2001-10-04 01:59 UTC (permalink / raw)
To: cnliou@eurosport.com; +Cc: pgsql-sql
> Hello!
>
> I vaguely remember that someone said somewhere that
> EXISTS runs faster than IN:
>
> SELECT * FROM table1 where field1 EXISTS (SELECT
> field4 FROM table2)
Move field1 into the subquery and join it to table2. See the FAQ for an
example.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-10-04 01:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04 01:18 EXISTS Keyword cnliou@eurosport.com
2001-10-04 01:59 ` Bruce Momjian <pgman@candle.pha.pa.us>
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