|
|
Archives of the TeradataForum
Message Posted: Fri, 31 Oct 2003 @ 13:48:30 GMT
Subj: | | Re: Concurrent Users |
|
From: | | Thomas F. Stanek |
Craig,
I am assuming that when you say "concurrent users", you mean that you want to know how many users were logged on at a given point in
time. If so, you can always determine that through LogonOff historically or, as Victor pointed out, through SessionInfo in real time.
Historically, you can get the point in time as follows:
select count(*)
from dbc.logonoff b
left outer join
dbc.logonoff a
on a.username = b.username
and a.sessionno = b.sessionno
and a.logicalhostid = b.logicalhostid
where b.event = 'logon'
and (
(a.event in ( 'logoff', 'forced off')
and 120000 between b.logontime and a.logtime
and date-5 between b.logondate and a.logdate)
OR
(a.event is null
and a.logdate||a.logtime <= date-5||120000)
)
This would give you the number of sessions that were logged on at a point in time, i.e. 12:00:00 five days ago.
Hope this helps.
Thomas F. Stanek
TFS Consulting, Inc.
www.tfsconsulting.com
| |