Ritesh-123787
SSC Veteran
Points: 256
More actions
February 13, 2004 at 3:37 am
#107539
how to optimize following qry which running on tables with million records
select * from tab1 where ID not in (select ID from tab2)
inugroho
SSC Enthusiast
Points: 145
February 13, 2004 at 4:40 am
#493969
Use left outer join, and filter out the match pairs
select t1.* from tab1 t1
left outer join tab2 t2 on t2.ID=t1.ID
where t2.ID is null
Hope this would help
Thanx
SQLBill
SSC Guru
Points: 51440
February 13, 2004 at 1:40 pm
#494059
Do you really need to retrieve EVERYTHING? (SELECT *)
If not, change the * to a list of the columns that you really need.
-SQLBill
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply