Optimizing Distributed Queries

Microsoft® SQL Server™ distributed queries allow users to reference remote tables and rowsets as though they are local tables by using SELECT, INSERT, UPDATE, and DELETE statements. Distributed queries cause data to be retrieved across the network when data sources are located on remote computers; therefore, SQL Server performs two types of optimization, specific to distributed queries, to improve performance:

An OLE DB provider is considered to be a SQL Command Provider if the OLE DB provider meets the following minimum requirements:

An OLE DB Provider is considered to be an Index Provider if the OLE DB provider meets the following minimum requirements:

Remote Query Execution

SQL Server attempts to delegate as much of the evaluation of a distributed query to the SQL Command Provider as possible. An SQL query that accesses only the remote tables stored in the provider’s data source is extracted from the original distributed query and executed against the provider. This reduces the number of rows returned from the provider and allows the provider to use its indexes in evaluating the query.

Considerations that affect how much of the original distributed query gets delegated to the SQL Command Provider include:

Indexed Access

SQL Server can use execution strategies that involve using the indexes of the Index provider to evaluate predicates and perform sorting operations against remote tables. Set the IndexAsAccessPath provider option to enable indexed access against a provider.

Additionally, when using indexes involving character columns, set the collation compatible linked server configuration option to true for the corresponding linked server. For more information, see sp_serveroption.


Note Graphically display the execution plan using SQL Server Query Analyzer to determine the execution plan for a given distributed query. When remote query execution is employed in the execution plan, it is represented using the Remote Query logical and physical operator. The argument of this operator shows the remotely executed query.


See Also
Configuring OLE DB Providers for Distributed Queries Subquery Fundamentals

 

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.