From: | Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com> |
---|---|
To: | PostgreSQL General Discussion Forum <pgsql-general(at)postgresql(dot)org> |
Subject: | NOT IN and NOT EXIST |
Date: | 2014-07-03 15:35:07 |
Message-ID: | CADp-Sm5O-n+upp-B+6SUq-wT6EeEBrjoR_roPkOp7D8Rnk2K5w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
Postgres optimizer automatically tries to convert an IN clause to Hash Join
(something similar to EXISTS equivalent of that query).
Does a similar translation happen for NOT IN as well? Given that the column
used is NOT NUL.
Select * from emp where deptid not in (select deptid from dept where
deptLocation='New York');
Will this above statement be automatically converted to a plan which would
match below statement?
Select * from emp where not exists (select 1 from dept where
deptLocation='New York' and dept.deptid=emp.deptid);
Regards
Sameer
PS: Sent from my Mobile device. Pls ignore typo n abb
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Crawford | 2014-07-03 15:52:02 | Re: NOT IN and NOT EXIST |
Previous Message | Arup Rakshit | 2014-07-03 15:33:10 | Re: Not able to understand how to write group by |