SQL/MX 2.x Query Guide (G06.24+, H06.03+)
Reviewing Query Execution Plans
HP NonStop SQL/MX Query Guide—523728-003
4-21
Simple Query Example
Simple Query Example
This query selects all rows and columns from the EMPLOYEE table:
>>prepare q1 from
+>select * from employee;
--- SQL command prepared.
>>execute Q1;
The query returns this result:
EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY
------ ----------- ---------- ------- -------- ------
1 ROGER GREEN 9000 100 175500.00
. . . . .
568 JESSICA CRINER 3500 300 39500.00
--- 62 row(s) selected.
To obtain statistics about the query, after the query executes, enter:
>>DISPLAY STATISTICS;
The statistics are returned:
Start Time 2005/05/06 10:45:53.916
End Time 2005/05/06 10:45:53.975
Elapsed Time 00:00:00.059
Compile Time 00:00:00.000
Execution Time 00:00:00.059
Table Name Records Records Disk Message Message Lock
Accessed Used I/Os Count Bytes
SAMDBCAT.PERSNL.EMPLOYEE
62 62 2 2 14608 0
If you want to display statistics automatically, enter SET STATISTICS ON at any point
during the session. As a result, the statistics appear immediately after each command
executes.
Using Measure
Use the Measure product to gather statistics on an SQL/MX database and application
programs. The Measure product provides statistics on process execution (SQLPROC)
and on individual statement execution (SQLSTMT). For information on using Measure
with SQL/MX, see the SQL/MX Installation and Management Guide. For information
about the Measure product, see the Measure Reference Manual.
Process Execution (SQLPROC)
For each process, the Measure product provides these statistics: