Search Postgresql Archives

Re: How would I write this query...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



select *
from people
where id not in
(
select id
from class_registration
)

In my experience, queries like the OUTER LEFT JOIN version posted earlier are usually much more efficient than NOT IN queries like the above. The planner seems to be pretty smart about turning (positive) IN queries into joins, but NOT IN queries usually turn into nested table scans, in my experience.

- John D. Burger
  MITRE



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux