SQL/MP Programming Manual for C
Program Invalidation and Automatic SQL 
Recompilation
HP NonStop SQL/MP Programming Manual for C—429847-008
8-6
Causes of Automatic Recompilation
Automatic SQL recompilation performs these functions: 
Uses the current description of the database to determine the most efficient access 
path for each referenced database object
Maximizes database availability and node autonomy by generating a new 
execution plan at run time 
Allows a program to reference database objects that did not exist during explicit 
SQL compilation 
Allows a program to use a new set of DEFINEs to specify a different database (for 
example, a development database rather than a production database) 
You can enable or disable automatic SQL recompilation when you explicitly SQL 
compile a program. The RECOMPILE option (the default) enables automatic SQL 
recompilation, whereas the NORECOMPILE option disables it. 
Causes of Automatic Recompilation 
If automatic SQL recompilation is enabled (the NORECOMPILE option is not 
specified), the SQL executor invokes the SQL compiler to recompile a program or 
statement (depending on the RECOMPILEALL or RECOMPILEONDEMAND option) in 
these situations: 
The program file is marked invalid at SQL load time. 
The DEFINE values at SQL load time are different from the DEFINE values used 
to explicitly SQL compile the program. 
The timestamp check fails for an SQL object referenced in an SQL statement. 
An unavailable access path (index) exists. 
The program file contains an uncompiled SQL statement. 
In some cases, you can prevent automatic recompilation using the similarity check. For 
more information, see Preventing Automatic Recompilations
 on page 8-9. 
Invalid SQL Program File
SQL load time occurs when the SQL executor runs the first SQL statement in a 
program. If the SQL program on disk is invalid for any of the reasons listed in Causes 
of Program Invalidation on page 8-2, the SQL executor forces the recompilation of the 
program or statement. To control the automatic recompilation, specify the 
RECOMPILEALL option (the default) to cause the recompilation of the entire program 
or the RECOMPILEONDEMAND option to limit the recompilation to statements 
actually run. 










