Processing queries: Overview

This overview of the query optimizer provides guidelines for designing queries that perform and use system resources more efficiently.

This overview covers queries that are optimized by the query optimizer and includes interfaces such as SQL, OPNQRYF, APIs (QQQQRY), ODBC, and Query/400 queries. Whether you apply the guidelines, the query results are still correct.

Note: The information in this overview is complex. You might find it helpful to experiment with an IBM® i product as you read this information to gain a better understanding of the concepts.

When you understand how Db2® for i processes queries, it is easier to understand the performance impacts of the guidelines discussed in this overview. There are two major components of Db2 for i query processing:

  • How the system accesses data.

    These methods are the algorithms that are used to retrieve data from the disk. The methods include index usage and row selection techniques. In addition, parallel access methods are available with the DB2® Symmetric Multiprocessing operating system feature.

  • Query optimizer

    The query optimizer identifies the valid techniques which can be used to implement the query and selects the most efficient technique.