The federated database optimizes the performance of SQL queries against heterogeneous data sources by leveraging the DB2® query optimizer and by determining when it is faster to process a query on the data source or on the federated database.
For relational data sources, each type of relational database management system supports a subset of the international SQL standard. If an SQL construct is found in the DB2 SQL dialect but not in the relational data source dialect, the federated server can implement this construct on behalf of the data source.
Even data sources with weak SQL support or no SQL support will benefit from compensation.
As part of the SQL compiler process, the query optimizer analyzes a query. The compiler develops alternative strategies, called access plans, for processing the query.
Access plans might call for the query to be processed by the data source, the federated server, or partly by each.
The query optimizer uses information in the wrapper and global database catalog to evaluate query access plans. The optimizer decomposes the query into segments that are called query fragments. Typically it is more efficient to push down a query fragment to a data source if the data source can process the fragment. However, the query optimizer evaluates other factors:
The query optimizer generates access plan alternatives for processing a query fragment. The plan alternatives perform varying amounts of work locally on the federated server and on the remote data sources. The query optimizer chooses the plan with the least resource consumption cost.