cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Max User Query?

6,670

How would you figure out what how many users were ever logged in at the same time?

I am trying to come up with some testing scenarios for our software, and I know how many users there are total for a given site, and therefore how many possibly could be logged in at the same time. But I was wondering if there was a counter in the DB that I could query that kept track of how many actually ever were logged in at the same time historically.

View Entire Topic
Breck_Carter
Participant

An old-school solution for the maximum number of connections to this database...

CREATE TABLE max_connected_users ( 
   on_date         DATE NOT NULL PRIMARY KEY,
   max_connections INTEGER NOT NULL );

CREATE EVENT record_max_connections TYPE CONNECT HANDLER
BEGIN

INSERT max_connected_users
   ON EXISTING SKIP
   VALUES ( CURRENT DATE, 0 );

UPDATE max_connected_users
      SET max_connections = GREATER ( max_connections, DB_PROPERTY ( 'ConnCount' ) )
    WHERE on_date = CURRENT DATE;

END;
MarkCulp
Participant
0 Likes

Note that the ConnCount database property counts more than just user connections - it includes event connections and external environment connections.

VolkerBarth
Contributor
0 Likes

@Breck: "Old-school" - so you don't code MERGE all the day? 🙂

Breck_Carter
Participant
0 Likes

Someday, I will code a MERGE... alt text