join vs exists

From: AI Rumman <rummandba(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: join vs exists
Date: 2010-06-20 08:55:45
Message-ID: AANLkTin4erNwsmyy052lb-ZNbvqPOLWMgS5V66q6Fd9T@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Which one is good - join between table or using exists in where condition?

Query 1;

Select a.*
from a
where exists
(
select 1 from b inner join c on b.id1 = c.id where a.id = b.id)

Query 2:
select a.*
from a
inner join
(select b.id from b inner join c on b.id1 = c.id) as q
on a.id = q.id

Any suggestion please.

Browse pgsql-performance by date

  From Date Subject
Next Message Szymon Guz 2010-06-20 11:23:33 Re: Slow function in queries SELECT clause.
Previous Message Davor J. 2010-06-19 19:38:14 Slow function in queries SELECT clause.