Adaptive Query Processing

Adaptive Query Processing analyzes actual query run time statistics and uses that information for subsequent optimizations.

With rapidly increasing amounts of data, the price of miscalculating complex plans can result in dramatic performance problems. These problems might be measured in minutes or hours instead of seconds or minutes. Traditionally, optimizer architecture has attempted to overcome potential plan problems in several ways. The most common technique is to increase the amount of time spent optimizing a query, searching for safe alternatives. While additional time reduces the likelihood of a failed plan, it does not fundamentally avoid the problem.

The DB2 optimizer relies on statistical estimates to optimize a query. These estimates can be inaccurate for a number of reasons. The reasons include a lack of statistical metadata for the query tables, complex join conditions, skewed or rapidly changing data within the tables, and others.

The SQE query engine uses a technique called Adaptive Query Processing (AQP). AQP analyzes actual query run time statistics and uses that information to correct previous estimates. These updated estimates can provide better information for subsequent optimizations.