假设我有两个 SQL Server 数据库在不同的机器上运行,将它们MachineA
称为MachineB
.
如果我执行如下查询
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
,实际在哪里执行工作?是否MachineA
执行所有读取并将行发送到MachineB
for JOIN
ing?还是这里发生了更复杂的事情?