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 |
pcpham
Starting Member
10 Posts |
Posted - 2010-06-04 : 02:55:17
|
Hi Guys,I have a remote server accessible via an IP address that I have registered in SQL Server Management. One table Contacts contain 100,000 records. My query SELECT * FROM dbo.Contact WHERE (CrmPersonStatus = 16) OR (CrmPersonStatus = 17) OR (CrmPersonStatus = 19)Takes 10-15 minutes to run.If I run the same query using linked serverSELECT * FROM [xxx.xxx.xxx]xxx].Table1.dbo.Contact WHERE (CrmPersonStatus = 16) OR (CrmPersonStatus = 17) OR (CrmPersonStatus = 19)It takes 30 seconds...My question is why would it take that long for the first query?Thanks,Paula |
|
Kristen
Test
22859 Posts |
Posted - 2010-06-04 : 05:14:49
|
Interesting.My guess would be that in the first SSMS is pulling data from RemoteServer using ADO - perhaps row-by-row or somesuch, with some inherent inefficiency (surprising given that this is SSMS and one assumes "as good as it gets") - maybe that connection is using Named Pipes or something ghastly?!Second one is presumably a connection to a "local" server? thus the connection is from LocalServer to [linked] RemoteServer and maybe that connection is set up more optimally.If this turns out to be always the case I'm definitely going to adopt it as a way of working though! |
 |
|
|
|
|