views:

1253

answers:

2

This could be the userid's or number of users.

Thanks in advance.

+5  A: 

(question) Don't you get that info in

select * from pg_user;

or using the view

pg_stat_activity

Added:

the view says:

One row per server process, showing database OID, database name, process ID, user OID, user name, current query, query's waiting status, time at which the current query began execution, time at which the process was started, and client's address and port number. The columns that report data on the current query are available unless the parameter stats_command_string has been turned off. Furthermore, these columns are only visible if the user examining the view is a superuser or the same as the user owning the process being reported on.

can't you filter and get that information? that will be the current users on the Database, you can use began execution time to get all queries from last 5 minutes for example...

something like that.

balexandre
No, that is the list of known users, not the number currently connected.
Keltia
how about the Stats collector? (follow the link on the view name)
balexandre
yep, I tried it but gives me all users
mm2010
@mm2010: pg_stat_activity: active users only. pg_user: list all users
Hao
+1  A: 

Using balexandre's info:

SELECT usesysid, usename FROM pg_stat_activity;
Sven Lilienthal