Distributed queries
From: KH (KH_at_discussions.microsoft.com)
Date: 12/01/04
- Next message: Aaron [SQL Server MVP]: "Re: "CAST" question"
- Previous message: KH: "Distributed queries"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Dec 2004 10:09:06 -0800
As always the answer to these Q's will depend on a number of factors, but in
general...
- For a distributed query, is a plan cached on the local machine? The remote
machine? Both or neither? My guess is that it depends on whether the query
references only the remote server(s) or both local and remote.
Examples - If executed on "LocalServer", where is the query plan saved (if
at all)?
-- 1 :: Reference remote server only
SELECT x FROM RemoteServer.SomeDB.dbo.SomeTable WHERE x > @var
-- 2 :: Join local and remote tables
SELECT a.whatever
FROM dbo.SomeTable AS a
JOIN RemoteServer.SomeDB.dbo.SomeTable AS b ON a.whatever = b.whatever
WHERE b.whatever > @var
- In having to reconcile data between multiple servers my experience has
been that running a simple remote query and saving the data in a temp table
(or other method) and working with it locally has better performance than
joining across the network.
My guess is that with a join between tables on networked servers, SQL Server
copies data to the local machine then goes about its business. That's fine
for a single query but if you need to use the same data multiple times I'm
guessing doing only one remote query is better?
Anyone care to elaborate?
Thanks -- Ken
- Next message: Aaron [SQL Server MVP]: "Re: "CAST" question"
- Previous message: KH: "Distributed queries"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|