Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
subhaoviya
Posting Yak Master
135 Posts |
Posted - 2012-10-09 : 05:34:49
|
Hi, I am having query SELECT * from Table1 where ID not in (SELECT ID from Table2) which have million of records Table1 and thousands of records in Table2. for executing this query it taken more than 10 min How to fast it up? |
|
sql-programmers
Posting Yak Master
190 Posts |
Posted - 2012-10-09 : 05:41:30
|
Please try this and update I hope which will help you.SELECT * from Table1 LEFT JOIN Table2 ON Table2.ID = Table1.IDWhere Table2.ID IS NULLI think, JOIN will be better than NOT IN.SQL Server Programmers and Consultantshttp://www.sql-programmers.com/ |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-09 : 23:12:33
|
what all indexes you've on table?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|