NOT EXISTS or LEFT JOIN which one is better?
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
To
:
pgsql-performance@xxxxxxxxxxxxxx
Subject
: NOT EXISTS or LEFT JOIN which one is better?
From
: AI Rumman <
rummandba@xxxxxxxxx
>
Date
: Sun, 29 Apr 2012 15:27:19 +0600
I can write a query to solve my requirement in any of the followings :-
1.
select *
from a
where NOT EXISTS
(
select 1
from b
where
a.id
=
b.id
)
union all
select *
from b
2.
select
(
case when
b.id
is not null then
b.id
else
a.id
) as id
from a
left join b
on
a.id
=
b.id
Any one please tell me which one is better?
Follow-Ups
:
Re: NOT EXISTS or LEFT JOIN which one is better?
From:
Rich
Prev by Date:
Re: Weird plan variation with recursive CTEs
Next by Date:
Re: NOT EXISTS or LEFT JOIN which one is better?
Previous by thread:
auto-vacuum vs. full table update
Next by thread:
Re: NOT EXISTS or LEFT JOIN which one is better?
Index(es):
Date
Thread
[Postgresql General]
[Postgresql PHP]
[PHP Users]
[PHP Home]
[PHP on Windows]
[Kernel Newbies]
[PHP Classes]
[PHP Books]
[PHP Databases]
[Yosemite]