RE: Simple SQL Query

From: Joel Slowik <jslowik_at_cps92.com>
Date: Thu, 7 Jan 2010 12:06:21 -0500
Message-ID: <7FCAE6F848605649B090362F7C518C4802923971_at_cpsexchange.cps92.com>



Had you tried?:  

Select first.id

From first

Where not exists (select second.id

                                                From second

                                                Where second.id =
first.id)  

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Pani Babu Sent: Thursday, January 07, 2010 12:04 PM To: oracle-l_at_freelists.org
Subject: Simple SQL Query  

I have a simple SQL query which lists all the records that are not in a second table.

select first.id from first
where first.id not in (select id from second);

As the second table is very huge, it takes a very long to process the query.
Is there a way to rewrite the query to run it quicker?

Confidentiality Note: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact Continuum Performance Systems at {203.245.5000} and delete and destroy the original message and all copies.

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jan 07 2010 - 11:06:21 CST

Original text of this message