You can check connection details in Postgres using pgstatactivity. You can apply filter to satisfy your condition.
Spawn a container and jump right into a shell
The query to check number of connection to db and more details about activity