IBM Books

SQL Reference

CURRENT QUERY OPTIMIZATION

The CURRENT QUERY OPTIMIZATION special register specifies an INTEGER value that controls the class of query optimization performed by the database manager when binding dynamic SQL statements. The QUERYOPT bind option controls the class of query optimization for static SQL statements (see the Command Reference for additional information on the QUERYOPT bind option). The possible values range from 0 to 9. For example, if the query optimization class is set to the minimal class of optimization (0), then the value in the special register is 0. The default value is determined by the dft_queryopt database configuration parameter.

Its value can be changed by the SET CURRENT QUERY OPTIMIZATION statement (see SET CURRENT QUERY OPTIMIZATION).

Example

Using the SYSCAT.PACKAGES catalog view, find all plans that were bound with the same setting as the current value of the CURRENT QUERY OPTIMIZATION special register.

    SELECT PKGNAME, PKGSCHEMA FROM SYSCAT.PACKAGES
      WHERE QUERYOPT = CURRENT QUERY OPTIMIZATION


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]