Ask Your Question
3

What is the method to determine the count of delay, active, and idle sessions in teradata for the previous week?

asked 2023-06-12 00:08:02 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-12 00:19:02 +0000

bukephalos gravatar image

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:

  1. Connect to the Teradata system using a tool such as Teradata SQL Assistant or Teradata Studio.
  2. Execute a query against the DBC.SessionInfo table, which contains information about all active sessions on the system. You can filter the results to only include sessions from the previous week using a WHERE clause that compares the StartTime column to a specific date range. For example:

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.

  1. To determine the number of active sessions, you can simply count the number of rows returned by the query:

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.

  1. To determine the number of idle sessions, you can look for sessions that have been inactive for a certain amount of time using the LastResponseTimeStamp column in the DBC.SessionInfo table. For example, you could define an idle session as one that has been inactive for more than 1 hour:

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.

  1. To determine the number of delayed sessions, you could define a delayed session as one that has been running for more than a certain amount of time. For example, you could consider any session that has been running for more than 1 hour as delayed:

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-12 00:08:02 +0000

Seen: 11 times

Last updated: Jun 12 '23