Hello, not really sure if this is the right part of the forum for this question but I have a strange performance problem.
I have two structurally identical databases one on main server and one on express edition standalone machine connected over VPN
this query is run on the standalone machine linked server is the main server
table1 is around 10 million rows on central server and around 100k rows on local server.
INSERT INTO [linkedsrv].MyDB.dbo.table1 (col1, col2,..)
SELECT col1, col2,.. from table1 a WHERE timestamptable >= olddbts and timestamtable < newdbts
AND NOT EXISTS (SELECT 1 FROM [linkedsrv].MyDB.dbo.table1 WHERe pk1=a.pk1 AND pk2=a.pk2 and pk3=a.pk3 and pk4=a.pk4)
pk1 trough pk4 are the complete primary key of table1
timestamptable >= olddbts and timestamtable < newdbts usually limits the number of rows to 500 - 2000.
the performance monitor chose the nested loops left anti semi join.
with the network latency of about 8ms I get very poor results.
(for every row of local table it calls the linked table)
Should I use join hints?
If so which would be best? Merge / Hash