Tag Info

New answers tagged

3

As a general rule of thumb, you should give the database as much information as possible about the task that you're implementing. How does this apply to your scenarios? Scenario 1 (INSERT .. SELECT) The database knows that you're about to bulk-move a whole set of data from one table or from one derived table to another. It can optimise the execution given: ...


1

For your specific example scenario 1 keeps all the data on the server. Scenario 2 will require the data to be packaged, sent over the wire to the client, where is must be buffered (and, perhaps, spilled to disk) then un-buffered, re-packaged and sent back to the server, where it will finally be processed. This network time adds up. Do this often enough ...



Top 50 recent answers are included