Using Postgres as App Database Opens a New Connection for Each User Logon

I’m running Metabase v0.37.2 using Docker on a Linux RHEL 8 server. I have setup about 25 Metabase users. I’m using Postgres as the application database and another Postgres database is also being used as the data source of the Metabase dashboards. I use my ID to start the Metabase application using Docker on port: 3000. When I look at Postgres (proccess_id, user logged on etc…) I see that my ID is logged-on about 21 times with different PIDs. It appears that each time a user logs on to the Metabase application, another process is started under my user id (Metabase started with my id) instead of the user who logged on to the Metabase application.The database that is being queried by Metabase to build dashboards is Postgres. The multiple PIDs are happening on the Postgres database being used for the application data. Can someone explain if this is the case and how/why Metabase is handling Postgres processes to the application data ?

Here is the Postgres query I’m using to see these logons:

select datname as database_name,
pid as process_id,
usename as username,
client_addr as client_address,
application_name,
backend_start,
state,
state_change
from pg_stat_activity
where datname > ’ ’ and application_name > ’ ’
order by database_name desc, username desc;

Here is the Database- PID - Username from above query:

Hi @sascjm
I think there’s a misunderstanding. You have configured Metabase to connect to it’s application database with the credentials you set define with environment variables MB_DB_*
This is where the username comes from. It will always be the same username as you have defined in the credentials.

Yes I did use my credentials but why are there 15 or so idle connections?

@sascjm Metabase has a default of maximum 15 connections to the application database, which can be configured:
https://www.metabase.com/docs/latest/operations-guide/environment-variables.html#mb_application_db_max_connection_pool_size
It’s supposed to close idle connections, but it could be caused by different “keep-alive” value than what Metabase expects. There’s an issue open about hanging connections:
https://github.com/metabase/metabase/issues/8679