Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 609EF475EBB for ; Mon, 27 Jan 2003 02:36:17 -0500 (EST) Received: from web80301.mail.yahoo.com (web80301.mail.yahoo.com [66.218.79.17]) by postgresql.org (Postfix) with SMTP id B4262475E75 for ; Mon, 27 Jan 2003 02:36:16 -0500 (EST) Message-ID: <20030127073617.1057.qmail@web80301.mail.yahoo.com> Received: from [203.87.150.116] by web80301.mail.yahoo.com via HTTP; Sun, 26 Jan 2003 23:36:17 PST Date: Sun, 26 Jan 2003 23:36:17 -0800 (PST) From: Ludwig Lim Subject: Re: [ADMIN] how sub queries and joins differs funcationally To: shreedhar Cc: 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/420 X-Sequence-Number: 11285 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