Connectors and query processor interaction
During query processing, the query processor runs SQL queries, accesses the metadata catalogs, and calls connectors.
A connector uses the information in the WHERE clause of a query to attempt to access the database or file with optimum performance. The query processor inspects the data that the connector returns to determine if the data meets the WHERE qualification, if specified. The data that remains is then staged so that query results are not returned to the client until the complete result set is built. After all the data is read and staged, the required post-processing is performed, and those results are staged. Post processing includes sorting when an ORDER BY clause is specified and when evaluating rows for aggregate functions. After the query processor finishes processing the staged results, the final result set is returned to the client application.
The connectors optimize query processor performance using index information. If the connector cannot optimize access to the database or file, the connector attempts another optimization method. The connector filters the number of records returned to the query processor by analyzing the WHERE clause on the data that is returned from the database or file system. If the connector can successfully filter the records that are returned, the connector notifies the query processor not to run the corresponding filtering instructions at the query processor level.