I have a query running in SQL Server 2005 sp2 that takes just over 5½ minutes to run despite my best efforts to speed it up.
It is an INSERT INTO local table SELECT FROM sql statement. If I just run the SELECT part, it still takes over 5½ minutes. The query is currently returning 2 rows of data.
However, If I change the table it inserts into to be an identical table on a remote server using a linked server, then it runs in 3 seconds????
I like the time it now takes, but I do not understand why it is so much faster inserting into a table on a remote server. If anything, I expected it to take a little longer - anyone have any ideas?
These are examples of the query:
--Takes approximately 05:26 to complete
View Complete Post