Neoview SQL Reference Manual (R2.2)

EXPLAIN Statement
The EXPLAIN statement helps you to review query execution plans. You can use the EXPLAIN
statement anywhere you can execute other Neoview database statements (for example, SELECT).
For information about Neoview Script, see the HP Neoview Script Guide For more information on
the EXPLAIN function, see “EXPLAIN Function” (page 339).
NOTE: Formatting changes to the EXPLAIN output data might occur in the future. If so, you
might need to modify any scripts that parse the output of the command.
The syntax for the EXPLAIN statement supports four output options. Table 2-2 summarizes the
options.
Table 2-2 EXPLAIN Statement Options
PurposeOption TypeSyntax
Provides the simple, basic information contained in the
query execution plan. This information is formatted for
readability and limited to 79 characters (one line) per
operator.
Formatted
OPTIONS 'f'
Provides the most important information contained in the
query execution plan. This information is formatted for
readability and is the default output format.
Normal user
OPTIONS 'n'
Provides all information contained in the query execution
plan. This information is formatted for readability.
Expert user
OPTIONS 'e'
Provides all information contained in the query execution
plan. This information is formatted for machine readability
(easy to parse with software tools). Same format as EXPLAIN
function (see “EXPLAIN Function” (page 339)).
Machine readable
OPTIONS 'm'
Plans displayed by the EXPLAIN statement OPTIONS ‘n’, ‘e’, and ‘f’ are ordered from top (root
operator) to bottom (leaf operators). The machine-readable format (option ‘m’) orders plans from
bottom (leaf operators) to top (root operator).
For detailed information about the operators in the query execution plan, see the Neoview Query
Guide.
Syntax
EXPLAIN [OPTIONS {'f' | 'n' | 'e' | 'm'}] {query-text | prepared-stmt-name}
f
formatted. See “Formatted [OPTIONS 'f'] Considerations” (page 105).
n
normal user (default setting). See “Normal User [OPTIONS 'n'] Considerations” (page 106).
e
expert user. See “Expert User [OPTIONS 'e'] Considerations” (page 108).
m
machine readable format. See “Machine-Readable [OPTIONS 'm'] Considerations” (page 110).
query-text
a DML statement such as SELECT * FROM T3.
prepared-stmt-name
an SQL identifier containing the name of a statement already prepared in this session. An
SQL identifier is case-insensitive (will be in uppercase) unless it is double-quoted. It must
be double-quoted if it contains blanks, lowercase letters, or special characters. It must start
with a letter. When you refer to the prepared query in a SELECT statement, you must use
uppercase.
104 SQL Statements