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 |
|
Aleph_0
Yak Posting Veteran
79 Posts |
Posted - 2011-05-11 : 16:45:28
|
| So I learned (the hard way) that it's a lot faster to do things in steps with temporary tables rather than one giant query when you've got big tables and lots of joins involved. But let's say I'm building a new table a couple of columns at a time - would it be better to do it with temp tables (let's say it'll take at least a few and they each have over a million records) or build the permanent table with NULLs and UPDATE it with each step? Or UPDATE a temp table and dump it into a permanent table at the end?Sorry I don't have a concrete example; this was just another thing I was curious about (I just recently read about UPDATE). Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-05-11 : 19:29:30
|
| Like Tara said - it depends. Creating a table and inserting a million rows, then running multiple updates across that table would likely take longer than just inserting the million rows with the right values up front.It really does depend on how each columns values are derived.Jeff |
 |
|
|
|
|
|