beautypg.com

List statement counts for a selected time period – HP Neoview Release 2.5 Software User Manual

Page 61

background image

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_VW2
WHERE QUERY_STATUS in ('REJECTED', 'INIT')
ORDER BY EXEC_START_LCT_TS DESC FOR READ UNCOMMITTED ACCESS;

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,
SUM(MESSAGE_BYTES_TO_DISK) as TTL_MESSAGE_BYTES_TO_DISK,
SUM(NUM_ROWS_IUD) as TTL_NUM_ROWS_IUD,
SUM(ROWS_ACCESSED) as TTL_ROWS_ACCESSED,
SUM(ROWS_RETRIEVED) as TTL_ROWS_RETRIEVED,
SUM(LOCK_ESCALATIONS) as TTL_LOCK_ESCALATIONS,
SUM(LOCK_WAITS) as TTL_LOCK_WAITS
FROM NEO.HP_METRICS.QUERY_STATS_VW2
WHERE
(ENTRY_ID_LCT_TS) >= cast(cast(('2010-03-15') as DATE) as TIMESTAMP(0))
AND (ENTRY_ID_LCT_TS) < CURRENT_TIMESTAMP
AND QUERY_STATUS = 'COMPLETED'
GROUP BY USER_NAME
ORDER BY USER_NAME;

List Statement Counts for a Selected Time Period

61