SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Name Resolution, Similarity Checks, and Automatic
Recompilation
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
8-11
Similarity Check
timestamps differ, the SQL/MX executor initiates a similarity check, comparing the
compile-time version to the run-time version of the table or view, to determine if the
query execution plan is still operable. See Similarity Check Criteria on page 8-11 and
Similarity Check Criteria for a View on page 8-13.
Controlling the Similarity Check
By default, the similarity check is enabled for all DML statements. To disable the
similarity check and force recompilation of an SQL/MX statement when a class MAP
DEFINE value or table, or view timestamp changes, use the CONTROL QUERY
DEFAULT or CONTROL TABLE statement with the SIMILARITY_CHECK option. For
example, this statement disables the similarity check for all tables in subsequent DML
statements:
CONTROL QUERY DEFAULT SIMILARITY_CHECK 'OFF';
This statement disables the similarity check for a specific table:
CONTROL TABLE samdbcat.persnl.job SIMILARITY_CHECK 'OFF';
If you need to re-enable the similarity check in the program, use the CONTROL
QUERY DEFAULT or CONTROL TABLE statement with the SIMILARITY_CHECK
option set to ON. For more information on coding CONTROL statements, see Using
CONTROL Statements on page 2-12 and the SQL/MX Reference Manual.
Similarity check for views is controlled at the view creation time by the CONTROL
QUERY DEFAULT, DDL_VIEW_SIMILARITY_CHECK. For example, this statement
enables the similarity check for all views in subsequent DDL statements:
CONTROL QUERY DEFAULT DDL_VIEW_SIMILARITY_CHECK 'ENABLE';
The CONTROL QUERY DEFAULT only applies in the absence of explicit syntax
options for similarity check for views. Similarity check for views can also be enabled
using ENABLE SIMILARITY CHECK in a CREATE VIEW or ALTER VIEW statement.
For more information, see the SQL/MX Reference Manual.
Similarity Check Criteria
During a similarity check, the SQL/MX executor compares the compile-time version of
a table with its run-time version. For the similarity check to pass:
Both tables must have the same table type (key-sequenced or entry-sequenced).
Both tables must be either audited or nonaudited.
Note. Although the SIMILARITY_CHECK option is enabled by default in NonStop SQL/MX, a
DML statement that refers to an SQL/MP table does not undergo a similarity check in NonStop
SQL/MX if the SQL/MP table was created with the SIMILARITY CHECK option disabled. To
determine if the similarity check is enabled for an SQL/MP table, check the
SIMILARITYCHECK column for the table in the TABLES table of the SQL/MP catalog. For
more information, see the SQL/MP Reference Manual.