September 29, 2010 at 8:34 am
Have an update to perform on a table with data from a warehouse. There are approximately 8 million records in the table on which I'm performing an update causing the lookup to load all 8 million records into memory. I've thought about instead of loading all of that data into memory I can perform an inner join with the tables from the warehouse and the one I'm checking updates on with a where clause to check if any of the columns form the source doesn't match the column on the table needing updates and directly load the records that need to be updated into a table and running an update statement. Would this be quicker than using a lookup?
September 29, 2010 at 8:54 am
The joining option will probably be faster.
You should try both just to see what the difference will be.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
September 29, 2010 at 8:58 am
You're essentially doing the same thing. Whether or not you load it into memory first, SQL will still pull all data into the cache..I'd be willing to bet you'd have very similar update times either way. This is assuming that there are enough rows to be updated that it would be doing a full scan on the data in question anyway, and not just a seek...if you're seeking, just joining will be faster.l
September 29, 2010 at 8:59 am
Good to know. Thanks guys.
September 29, 2010 at 11:03 am
dndaughtery (9/29/2010)
Have an update to perform on a table with data from a warehouse. There are approximately 8 million records in the table on which I'm performing an update causing the lookup to load all 8 million records into memory. I've thought about instead of loading all of that data into memory I can perform an inner join with the tables from the warehouse and the one I'm checking updates on with a where clause to check if any of the columns form the source doesn't match the column on the table needing updates and directly load the records that need to be updated into a table and running an update statement. Would this be quicker than using a lookup?
"It Depends". In fact, it depends a lot here. How many rows out of that 8 million are you actually updating?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply