prasadau2006 (1/28/2015)
Hello Friends,I need help with the following query, this query is taking more than 20mins to complete. I'm using a left join to
pull the data.
Query:
Insert into dbo.SecondTable
Select b.* From dbo.FirstTable a Left Join dbo.SecondTable b on a.Id=b.Id where b.Id is null
it inserts approximately 1.5million records.
Thanks for your help in advance
Can you post the Actual execution plan for the SELECT part of the query? 1.5 million rows is a cup of tea. The rate limiting part is the SELECT and how it is, or isn't, supported by indexes.
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]