Indexed Access
SQL Server uses an index exposed by the provider to evaluate certain predicates of the distributed query. This scenario is possible only against Index providers and when the user sets the Index as Access Path provider option. The following are the major high-level steps that SQL Server performs against the provider while using an index to execute a query:
- Opens the index rowset through IOpenRowset::OpenRowset with the full table name and index name. The full table and index names are generated as described in the remote queries scenario.
- Opens the base table rowset through IOpenRowset::OpenRowset with the full table name.
- Sets ranges on the index rowset based on the query predicate through IRowsetIndex::SetRange.
- Scans rows off the index rowset through IRowset on the index rowset.
- Uses the bookmark column from the retrieved index rows to fetch corresponding rows from the base table rowset through IRowsetLocate::GetRowsByBookmark.
- The rowset properties DBPROP_IRowsetLocate and DBPROP_BOOKMARKS are required on the rowset opened against the base table.