SQL Server › Linked Servers

How would you troubleshoot a linked server query that is running much slower than expected?

Advanced

Answer

You would examine the execution plan to see how much of the query is being processed remotely versus locally, check whether appropriate indexes exist on the remote table being queried, consider rewriting parts of the query using OPENQUERY to push more processing to the remote server, and verify that network latency between the two servers is not itself a significant bottleneck.
-- Check the execution plan for remote query operations
SET STATISTICS PROFILE ON;
SELECT * FROM RemoteServer.SalesDB.dbo.Orders WHERE OrderDate > '2026-01-01';
Real-world example A database administrator discovers that a slow linked server query was pulling an entire remote table across the network before filtering it locally, and fixes the issue by rewriting the query with OPENQUERY to filter the data on the remote server first.

Common follow-ups: What role does network latency play in linked server query performance?;How do you check if the remote table involved has appropriate indexes?