I'm trying to track the different wait time classes for current Oracle sessions but I must be misunderstanding something. When I compare the sum(time_waited)/1000 for a given session in gv$session_wait_class its often greater than the value of seconds_in_wait from gv$session and sometimes even greater than its last_call_et which I thought would be the total time...
What am I missing here? Why aren't they the same? I'm comparing numbers with this query:
select last_call_et,wait_time,seconds_in_wait,wait_time_micro/1000000,
(SELECT SUM(time_waited)
FROM gv$session_wait_class ot WHERE
ot.sid = ses.sid
AND ot.serial# = ses.serial#
AND ot.inst_id = ses.inst_id
)/1000 as wait_time_class from gv$session ses where sql_id is not null;