There are a few different methods to determine the count of delay, active, and idle sessions in Teradata for the previous week, but one possible approach is as follows:
SELECT * FROM DBC.SessionInfo WHERE StartTime >= DATE '2022-01-09' AND StartTime < DATE '2022-01-16';
This query will return all sessions that started between January 9th and January 15th, which represents the previous week.
SELECT COUNT(*) FROM DBC.SessionInfo WHERE StartTime >= DATE '2022-01-09' AND StartTime < DATE '2022-01-16';
This will give you the total count of active sessions during the previous week.
SELECT COUNT(*) FROM DBC.SessionInfo WHERE StartTime >= DATE '2022-01-09' AND StartTime < DATE '2022-01-16' AND (CURRENT_TIMESTAMP - LastResponseTimeStamp) HOUR > 1;
This will give you the total count of idle sessions during the previous week.
SELECT COUNT(*) FROM DBC.SessionInfo WHERE StartTime >= DATE '2022-01-09' AND StartTime < DATE '2022-01-16' AND (CURRENT_TIMESTAMP - StartTime) HOUR > 1;
This will give you the total count of delayed sessions during the previous week.
Asked: 2023-06-12 00:08:02 +0000
Seen: 11 times
Last updated: Jun 12 '23