
Retrieve Statistics for Completed Queries
This query lists information for the ten most recent queries that completed normally. You could
enhance this query to filter for time ranges, user IDs, or other attributes.
The list following the query shows values that might be returned in a single record.
SELECT [first 10] (EXEC_START_LCT_TS) AS EXEC_START_LCT_TS
,(SEGMENT_ID) AS SEGMENT_ID
,(QUERY_STATUS) AS QUERY_STATUS
,(QUERY_ELAPSED_TIME) AS QUERY_ELAPSED_TIME
,(cLIENT_NAME) AS CLIENT_NAME
from NEO.HP_METRICS.QUERY_STATS_VW1
where QUERY_STATUS='COMPLETED'
ORDER BY EXEC_START_LCT_TS DESC FOR READ UNCOMMITTED ACCESS;
ValueField
4/28/2010 12:37EXEC_START_LCT_TS
2SEGMENT_ID
COMPLETEDQUERY_STATUS
8312QUERY_ELAPSED_TIME
indigoCLIENT_NAME
Retrieve Statistics for Incomplete Queries
This query lists information about queries that have started but not ended. The result set is
ordered in descending chronological order (most recent first). The result set represents queries
that are active, queries that terminated abnormally, or queries where the user chose not to finish
fetching the data. If a query did not complete, fields that are not populated unless the query
completes have the value NULL.
The list following the query shows the values that might be associated with a specific row.
select [first 10] (EXEC_START_LCT_TS) AS EXEC_START_LCT_TS
,(SEGMENT_ID) AS SEGMENT_ID
,(QUERY_STATUS) AS QUERY_STATUS
,(cLIENT_NAME) AS CLIENT_NAME
from NEO.HP_METRICS.QUERY_STATS_VW1
WHERE QUERY_STATUS in ('REJECTED', 'INIT')
ORDER BY EXEC_START_LCT_TS DESC FOR READ UNCOMMITTED ACCESS;;
ValueField
2010-04-28 12:48:12.643290EXEC_START_LCT_TS
2SEGMENT_ID
INITQUERY_STATUS
indigoCLIENT_NAME
List Statement Counts for a Selected Time Period
This query returns statement counts by user name for a given time period that you provide. The
output following the query shows a single row of the output.
SELECT USER_NAME, count(*) as TTL_STMTS,
cast(MIN((ENTRY_ID_LCT_TS)) as timestamp(0)) as FIRST_TIME,
cast(MAX((ENTRY_ID_LCT_TS)) as timestamp(0)) as LAST_TIME,
sum(case when SQL_ERROR_CODE < 0 then 1 else 0 end ) as error_count,
SUM(DISK_IOS) as TTL_DISK_READS,
SUM(MESSAGES_TO_DISK) as TTL_MESSAGES_TO_DISK,
68 Examples and Guidelines for Creating Repository Queries
Comentarios a estos manuales