Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7949D4767D4 for ; Mon, 27 Jan 2003 02:52:37 -0500 (EST) Received: from web80314.mail.yahoo.com (web80314.mail.yahoo.com [66.218.79.30]) by postgresql.org (Postfix) with SMTP id 106D94763F9 for ; Mon, 27 Jan 2003 02:52:36 -0500 (EST) Message-ID: <20030127075236.66462.qmail@web80314.mail.yahoo.com> Received: from [203.87.150.116] by web80314.mail.yahoo.com via HTTP; Sun, 26 Jan 2003 23:52:36 PST Date: Sun, 26 Jan 2003 23:52:36 -0800 (PST) From: Ludwig Lim Subject: Re: how sub queries and joins differs funcationally To: PostgreSQL Mailing List In-Reply-To: <001601c2c5d1$a646cdd0$1201a8c0@a4005> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/279 X-Sequence-Number: 7121 Hi shreedhar : --- shreedhar wrote: > Can any body tell that how sub queries and joins > differs funcationally. > Because sub queries taking lot of time than joins. > The following could be the probable reasons: a) Your are using correlated queries - Correlated queries always re-evaluate the sub-query for each row processed. b) You have an IN clause - try using EXISTS clause, since it IN clause doesn't utilize the index when your subquery is another SELECT statement. ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com