External optimizer directives

External optimizer directives are optimizer directives that an administrator can create and store in the sysdirectives catalog table. The administrator can then use an ONCONFIG variable to make the directives available.

Client users also specify an environment variable and can choose to use these optimizer directives in queries in situations when they do not want to insert comments in SQL statements.

External directives are useful when it is not feasible to rewrite a query for a short-term solution to a problem, for example, when a query starts to perform poorly. Rewriting the query by changing the SQL statement is preferable for long-term solutions to problems.

External directives are for occasional use only. The number of directives stored in the sysdirectives catalog should not exceed 50. A typical enterprise only needs 0 to 9 directives.