SQL/MX 3.1 Reference Manual (H06.23+, J06.12+)
SQL/MX Statements
HP NonStop SQL/MX Release 3.1 Reference Manual—663850-001
2-275
SELECT ROW COUNT Statement
SELECT ROW COUNT Statement
Considerations for SELECT ROW COUNT
Limitations of SELECT ROW COUNT
Example of SELECT ROW COUNT
The SELECT ROW COUNT statement is used to retrieve the count of rows from an
SQL/MX table.
The SELECT ROW COUNT () query is sent to each disk process where a partition of
the table resides and the count of rows is computed as a parallel SQL operation.
Because the operation uses a stored count maintained for each partition of a table, the
SELECT ROW COUNT statement is an efficient way to obtain a row count.
table
specifies the name of the table for which you want to determine the number of
rows.
Considerations for SELECT ROW COUNT
•
The SELECT ROW COUNT statement can be issued from any interface where an
existing SELECT statement is allowed.
•
Other clauses, such as, WHERE, ORDER by, and GROUP by, are not allowed with
this SELECT statement.
•
table must be an SQL/MX base table.
•
SQL/MP tables are not supported.
•
When you use the EXPLAIN statement with a SELECT ROW COUNT statement,
the result displays the count operator as disk_label_stats.
•
The count is returned as if the target table is accessed in READ UNCOMMITTED
mode. This means that an inaccurate row count could be returned because of
transactions that have not yet committed.
Limitations of SELECT ROW COUNT
The SELECT ROW COUNT statement fails with an error 8022 (Stored row count is
invalid) under any of the following conditions:
•
The target table was created with an SQL version earlier than R3.0.
•
The target table was created with an SQL DUP operation.
•
The target table was created with a BACKUP RESTORE operation.
SELECT ROW COUNT FROM table










