SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-26
Similarity Checks and Automatic Recompilation
Similarity Checks and Automatic
Recompilation
This subsection explains what causes similarity checks and automatic recompilation to
occur and how to control these operations by coding CONTROL QUERY DEFAULT
statements in a program. See these topics:
Similarity Check on page 4-26
Automatic Recompilation on page 4-29
Recommended Recompilation Settings for OLTP Programs on page 4-30
Similarity Check
During a similarity check, the SQL/MX executor checks each table in a DML statement
at run time to determine if the query execution plan of the statement is still operable. A
similarity check is faster than the automatic recompilation of a query execution plan
and can reduce the performance costs of automatic recompilation.
If a statement fails the Similarity Check Criteria (or if the similarity check is disabled),
the SQL/MX executor, by default, invokes the SQL/MX compiler to automatically
recompile the SQL plan. For more information, see Automatic Recompilation on
page 4-29.
Causes of a Similarity Check
When enabled, a similarity check occurs for these reasons:
Changed DEFINEs on page 4-26
Failed Timestamp Check on page 4-27
Similarity checks are performed regardless of the method chosen to refer to tables in
the source code: hard-coded Guardian or logical names, or class map DEFINEs. For
more information, see Name Resolution on page 4-20.
To enable or disable similarity checks, see Controlling the Similarity Check on
page 4-27.
Changed DEFINEs
The SQL/MX executor performs a similarity check if a statement that was customized
for one table, specified by a class map DEFINE, will now be executed to process a
different table specified by a new DEFINE value. For more information, see Late Name
Resolution for SQL/MP Objects on page 4-23.
If the value of a DEFINE changes, the SQL/MX executor initiates a similarity check,
comparing the compile-time table to the run-time table, to determine if the query
execution plan is still operable. See Similarity Check Criteria on page 4-28.