Re: how sub queries and joins differs funcationally

From: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
To: PostgreSQL Mailing List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: how sub queries and joins differs funcationally
Date: 2003-01-27 07:52:36
Message-ID: 20030127075236.66462.qmail@web80314.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Hi shreedhar :

--- shreedhar <shreedhar(at)lucidindia(dot)net> 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Michiel Lange 2003-01-27 13:19:36 Re: Cannot connect to the database (PG 7.3)
Previous Message Ludwig Lim 2003-01-27 07:36:17 Re: [ADMIN] how sub queries and joins differs funcationally

Browse pgsql-sql by date

  From Date Subject
Next Message Boris Klug 2003-01-27 15:05:30 Please include hier-patch in next PostgreSQL version
Previous Message Ludwig Lim 2003-01-27 07:36:17 Re: [ADMIN] how sub queries and joins differs funcationally