EXPLAIN statement [ESQL]
522
After successful execution of the EXPLAIN statement, the sqlerrd[3] field
of the SQLCA (SQLIOESTIMATE) will be filled in with an estimate of the
number of input/output operations required to fetch all rows of the query.
A discussion with quite a few examples of the optimization string can be
found in "Monitoring and Improving Performance" on page 799 of the book
ASA User’s Guide.
♦
SQL/92 Vendor extension.
♦
Sybase Not supported in Adaptive Server Enterprise.
♦ The following example illustrates use of EXPLAIN:
EXEC SQL BEGIN DECLARE SECTION;
char plan[300];
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE employee_cursor CURSOR FOR
SELECT emp_id, emp_lname
FROM employee
WHERE emp_lname like :pattern;
EXEC SQL OPEN employee_cursor;
EXEC SQL EXPLAIN PLAN FOR CURSOR employee_cursor
INTO :plan;
printf( "Optimization Strategy: ’%s’.n", plan );
The plan variable contains the following string:
’employee (seq )’
Standards and
compatibility
Example