Query Engine Overview
DB2® UDB for iSeries™ provides two query engines to process queries: the Classic Query Engine (CQE) and the SQL Query Engine (SQE).
The CQE processes queries originating from non-SQL interfaces: OPNQRYF, Query/400, and QQQQry API. SQL based interfaces, such as ODBC, JDBC, CLI, Query Manager, Net.Data®, RUNSQLSTM, and embedded or interactive SQL, run through the SQE. For ease of use, the routing decision for processing the query by either CQE or SQE is pervasive and under the control of the system. The requesting user or application program cannot control or influence this behavior. However, a better understanding of the engines and of the process that determines which path a query takes can lead you to a better understand of your query's performance.
Along with the new query engine, several more components were created and other existing components were updated. Additionally, new data access methods were created for SQE.
- SQE and CQE Engines
To fully understand the implementation of query management and processing in DB2 UDB for iSeries on i5/OS® V5R2 and subsequent releases, it is important to see how the queries were implemented in releases of i5/OS previous to V5R2.
- Query Dispatcher
The function of the Dispatcher is to route the query request to either CQE or SQE, depending on the attributes of the query. All queries are processed by the Dispatcher and you cannot bypass it.
- Statistics Manager
In releases before V5R2, the retrieval of statistics was a function of the Optimizer. When the Optimizer needed to know information about a table, it looked at the table description to retrieve the row count and table size. If an index was available, the Optimizer might then extract further information about the data in the table. In V5R2, the collection of statistics was removed from the Optimizer and is now handled by a separate component called the Statistics Manager.
- Plan Cache
The Plan Cache is a repository that contains the access plans for queries that were optimized by SQE.
Parent topic:
Performance and query optimization
Related information
Embedded SQL programming
SQL programming
Query (QQQQRY) API
Open Query File (OPNQRYF) command
Run SQL Statements (RUNSQLSTM) command