SQL/MP Query Guide

Analyzing Query Performance
HP NonStop SQL/MP Query Guide524488-003
6-70
EXPLAIN Plan for MAX Optimization
Plan step 1 is a union of the result of plan steps 2 and 3. Plan step 1 executes after
plan steps 2 and 3.
Plan step 1 involves a sort operation to eliminate duplicate rows in the union result.
(Unless you specify UNION ALL, duplicate rows are automatically discarded from a
union result.)
Plan step 2 is a scan of the ordone table.
Plan step 3 is a scan of the ordtwo table.
EXPLAIN Plan for MAX Optimization
The EXPLAIN plan chooses MAX optimization for a query containing the MAX
aggregate function.
An index is created on the EMPLOYEE table:
CREATE INDEX SAL ON EMPLOYEE (SALARY,LAST_NAME,FIRST_NAME);
EXPLAIN
SELECT MAX(SALARY)
FROM EMPLOYEE
WHERE LAST_NAME > "JONES"
AND FIRST_NAME BETWEEN ?P1 AND ?P2;
The total cost of the query is 1.
Executor pred. : None
Table selectivity : Expect to select 100% of rows from table
Expected row count: 1 row after the scan
Operation cost : 1
Total cost : 3
Example 6-41. EXPLAIN Plan for UNION Operation (page 2 of 2)