Advertisement

09.20.2007 at 12:25PM PDT, ID: 22842453
[x]
Attachment Details

How does SQL Server process linked server rows?

Asked by Kevin3NF in MS SQL Server, Databases Miscellaneous

Tags: linked, sql

Architecture question.

I have ServerA.TableA (5 million rows) and ServerB.TableB (26 million rows)

I want to:
Select
    ServerA..TableA.Column1, ServerB..TableB.Column2
From
    ServerA..TableA, ServerB.dbo.TableB
Where
    ServerA..TableA.Column1 = ServerB..TableB.Column1
    AND
    ServerB..TableB.DateColumn between '2007-09-19' and getdate()

The query works and takes 5 minutes.  Too long

Issues:
There is no index on the relevant date column from the Where clause
Join is done in the WHERE instead of the FROM
I inherited this


The question:

How does SQL Server process these rows in memory?  Does it pull all 26 million rows into ServerA's memory and then join them?  What part of memory (mem-to-leave, BPool)?  Does it table scan for the date on Server B and then bring those rows back to Server A for joining?

I'm not looking for query optimization so much as I am looking for how SQL Server processes the rows in a linked server situation where the LS is also SQL Server.  I know it does strage things with non-SQL Server data in mem-to-leave.

If you can find some documentation on this that you can link to, that's would be really helpful as well.

Start Free Trial
[+][-]09.20.2007 at 02:04PM PDT, ID: 19931791

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.20.2007 at 09:40PM PDT, ID: 19933370

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.21.2007 at 05:29AM PDT, ID: 19934947

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, Databases Miscellaneous
Tags: linked, sql
Sign Up Now!
Solution Provided By: lahousden
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.25.2007 at 11:40AM PDT, ID: 19957940

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628