STMTKEY field in optimization profiles

Within a STMTPROFILE, the targeted statement is identified by the STMTKEY subelement. The statement that is defined in the STMTKEY field must match exactly to the statement being run by the application, allowing Db2® to unambiguously identify the targeted statement. However, 'white space' within the statement is tolerated.

After Db2 finds a statement key that matches the current compilation key, it stops looking. Therefore, if there were multiple statement profiles in an optimization profile whose statement key matches the current compilation key, only the first such statement profile is used. Statement file precedence is based on document order. No error or warning is issued in this case.

The statement key matches the statement ″select * from orders where foo(orderkey)>20," provided the compilation key has a default schema of ″COLLEGE″ and a function path of SYSIBM,SYSFUN,SYSPROC,DAVE.
<STMTKEY SCHEMA='COLLEGE' FUNCPATH='SYSIBM,SYSFUN,SYSPROC,DAVE'>
<![CDATA[select * from orders where foo(orderkey)>20]]>
</stmtkey>