Start of change

Global Statistics Cache

In SQE, the DB2® Statistics Manager stores actual row counts into a Global Statistics Cache. In this manner, the Statistics Manager refines its estimates over time as it learns where estimates have deviated from actual row counts.

Both completed queries and currently executing queries might be inspected by the Adaptive Query Processing (AQP) task, which compares estimated row counts to actual row counts. If there are any significant discrepancies, the AQP task notifies the DB2 Statistics Manager (SM). The SM stores this actual row count (also called observed row count) into a Global Statistics Cache (GSC).

If the query which generated the observed statistic in the GSC is reoptimized, the actual row count estimate is used in determining a new query plan. Further, if a different query asks for the same or a similar row count, the SM could return the stored actual row count from the GSC. Faster query plans can be generated by the query optimizer.

Typically, observed statistics are for complex predicates such as with a join. A simple example is a query joining three files A, B, and C. There is a discrepancy between the estimate and actual row count of the join of A and B. The SM stores an observed statistic into the GSC. Later, if a different join query of A, B, and Z is submitted, the SM recalls the observed statistic of the A and B join. The SM considers that observed statistic in its estimate of the A, B, and Z join.

The Global Statistics Cache is an internal DB2 object, and the contents of it are not directly observable.

End of change