Max simultaneous users - Mailing list pgsql-general

From webb sprague
Subject Max simultaneous users
Date
Msg-id 01051110103601.08603@lappi.o1.com
Whole thread Raw
In response to Re: SQL Server -> Postgres migration: Stored Procedure replacement?  (Roger Wernersson <rw@mindark.com>)
Responses WAL logs eating my diskspace!!
List pgsql-general
We have a table with a lot of user sessions (basically end -time and
length of connection).  We would like to query this table to count the max
number of simultaneous sessions, but we are stumped on how to do that.

The only thing I have been able to think of is to iterate over the entire
table and count the number of connections at the beginning and end of each
user session, keeping a variable that records the time and max number of
sessions at each iteration.  We can do this in either in Perl or PL/SQL, but
it seems like it would be *horribly* slow, especially considering we have
about 250,000 of these records come in a day.

I also wonder if there might be some intermediate data structure that we
could create to make this easy, but I thought I would rely on other people's
experience before trying to do this myself...:)

Thanks

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Help: Change the SQL query length
Next
From: teg@redhat.com (Trond Eivind Glomsrød)
Date:
Subject: Re: Too Many Open Files PG 7.1