SQL/MP Programming Manual for C

Program Invalidation and Automatic SQL
Recompilation
HP NonStop SQL/MP Programming Manual for C429847-008
8-8
Causes of Automatic Recompilation
4. The SQL executor invokes the SQL compiler to recompile the SELECT statement
using the current TAB definition. This recompilation does not modify the PROG
program file on disk, it changes only the copy of PROG in memory.
Unavailable Access Path (Index)
If the SQL executor encounters an unavailable access path (index) in the execution
plan of an SQL statement, the SQL executor invokes the SQL compiler to recompile
the statement. The SQL compiler then determines the best alternate access path, if
such a path exists, to run the statement. The SQL compiler recompiles only the
affected SQL statement when an access path is unavailable.
Uncompiled SQL Statement
If the SQL executor encounters an uncompiled SQL statement, it invokes the SQL
compiler to compile the statement. An SQL program file can contain an uncompiled
SQL statement in these cases:
The SQL statement referenced an SQL object that did not exist or was unavailable
during explicit SQL compilation.
The SQL statement referenced a DEFINE that did not exist during explicit
SQL compilation.
The program was explicitly compiled with the SQLCOMP FORCE option, and the
SQL statement generated an error.
Figure 8-1. Timestamp Check
Processor (CPU) Memory
SQL Executor Object Code
. . .
PROG Execution Plans
. . .
SELECT ... FROM TAB ...
SQL Executor compares
TAB timestamps in
PROG execution plan
and in TAB file label.
SQL recompilation rewrites copy of PROG
execution plan in memory only.
PROG
(Object
Code)
NonStop
SQL/MP
Database
PROG Execution Plans
. . .
SELECT ... FROM TAB ...
TAB Redefinition Timestamp
. . .
TAB Data
TAB File Label
Redefinition Timestamp
. . .
Timestamp Check
VST005.vsd