2012-06-22 56 views
0

假設我有兩臺運行在不同機器上的SQL Server數據庫,稱它們爲MachineAMachineB鏈接的服務器連接在哪裏執行計算?

如果我像執行哪裏,我們假設查詢上MachineA運行以下

SELECT 
    [Store].[Name] AS [Store Name], 
    [Employee].[Name] AS [Employee Name], 
    SUM([Sale].[Amount]) AS [Total Sales] 
FROM [MachineA].[DatabaseA].[dbo].[Sales] AS [Sale] 
INNER JOIN [MachineB].[DatabaseB].[dbo].[Employees] AS [Employee] 
ON [Sale].[EmployeeId] = [Employee].[EmployeeId] 
INNER JOIN [MachineB].[DatabaseB].[dbo].[Stores] AS [Store] 
ON [Employee].[StoreId] = [Store].[StoreId] 
GROUP BY [Store].[Name], [Employee].[Name] 

,在實際工作中執行哪裏查詢? MachineA是否執行所有讀取並將行發送到MachineB以獲得JOIN ing?或者更復雜的事情發生在這裏?

+0

檢查執行計劃並自己查看分析器。 –

回答

1

查詢優化器將根據鏈接的服務器驅動程序功能選擇最佳計劃。