SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Performance: Linked Server vs Registered Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pcpham
Starting Member

Australia
10 Posts

Posted - 06/04/2010 :  02:55:17  Show Profile  Reply with Quote
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 server

SELECT * 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

United Kingdom
22403 Posts

Posted - 06/04/2010 :  05:14:49  Show Profile  Reply with Quote
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!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000