Reputation: 1212
I have a SQL Server 2008 query which looks like this
Delete from Table1
INSERT INTO TABLE1
SELECT * FROM Table2
And I would like to improve the performance of this query by some means.
So, would be a nice approach to replace the Delete and Insert
query with Merge
statement which handles Delete, Update and Insert
in one single batch.
Please advice if any other way exist through which i can improve the performance of query.
Upvotes: 1
Views: 2816
Reputation: 11611
When you compare query profile statistic of using merge command and using insert and deleted command pay attention that merge command have better performance because number of insert, update,delete and select statement also number of transaction is lower in merge command. Also amount of DTS package is lower in merge command.
Upvotes: 1