Closed
Description
Proposal
Hello, I'm missing support to count connections to the database per-user. It's nice to see connections per database but when you have multiple users accessing to the database, you can't decide which one is the most consuming one.
You can count by datname
, like this:
But you can't count by usename
and datname
, like this:
postgres=# select usename, datname, count(*) from pg_stat_activity group by usename,datname;
usename | datname | count
-------------------+---------------+-------
postgres | mydb | 1
mydb | mydb | 15
postgres_exporter | postgres | 2
analytics | mydb | 2
postgres | postgres | 1
postgres_exporter | mydb2 | 1
mydb | postgres | 1
postfix | mydb | 1
postgres_exporter | mydb | 1
(9 rows)
Yes, I can do it via custom queries, but I think the right approach is via core pg_stat_activity_.*
metric stuff.
Maybe the easiest way is to add usename
label to pg_stat_activity_count
and add usename
to group by
.
Thank you
Metadata
Metadata
Assignees
Labels
No labels