SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
15-61
Displaying Query Execution Plans
the EXPLAIN function for a DML statement in a module. For more information on the
EXPLAIN function, see the SQL/MX Reference Manual and the SQL/MX Query Guide.
Displaying the Query Execution Plan of One Statement
To display the EXPLAIN output for a specific DML statement in a module, issue this
statement in MXCI:
Module Name
The module-name is the full name of a module, is case-sensitive, and must be placed
within single quotes:
'CAT.SCH.GRP1^MOD1^TABLESET1^VER1'
The module name is either specified by the MODULE directive in the embedded SQL
source file or by the preprocessor-generated module name if you did not use a
MODULE directive. For more information on the module name, see Module
Management Naming on page 17-8.
Statement Pattern
The statement-pattern is the name of a DML statement in the module. The
statement-pattern is case-sensitive and must be placed within single quotes:
'MX_DEFAULT_STATEMENT_0'
To determine the name of a particular SQL statement, if you SQL compiled your
module with:
•
mxcmp, look in the module definition file. The module definition file is an ASCII file
that you can view.
•
mxCompileUserModule (creating an annotated source file with embedded
module definitions), you cannot simply view the annotated source file as it is a
binary file. You can determine the statement names if you know the module name.
For more information on the module name, see Module Name on page 15-61.
Note. If there is no EXPLAIN output for a statically compiled application, the
GENERATE_EXPLAIN default attribute might have been turned off during compilation. In this
case, verify that GENERATE_EXPLAIN is on and recompile the application.
SELECT * FROM TABLE(EXPLAIN('module-name',
'statement-pattern'));
Note. Do not confuse module files, which do not have file extensions and reside in the
application’s base directory or in the /usr/tandem/sqlmx/USERMODULES directory, with
module definition files (.m), which are optionally generated during preprocessing and are
precursors to modules. For more information, see Module Management Naming on page 17-8.