I am finding bits and pieces of this solution everywhere, but nothing is matching my situation.
I am trying to deploy a site using docker, and connecting to a digital ocean postgres account. I have the smallest account possible, 1GB ram, which seems like it should be fine for starting up an application with no users yet.
When I try to run the container locally, I get flooded with the following error:
Postgrex.Protocol (#PID<0.1907.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections
my current pool_size is set to 10.
when I check the connections (nothing is attached to this database that I can tell), I get
select max_conn,used,res_for_super,max_conn-used-res_for_super
res_for_normal
from
(select count(*) used from pg_stat_activity) t1,
(select setting::int res_for_super from pg_settings where
name='superuser_reserved_connections') t2,
(select setting::int max_conn from pg_settings where name='max_connections') t3
max conn = 25
used = 25
If i look at the insights tab in digital ocean, it shows a consistent 15 connections, all day and night.
Am i missing something in my configuration? Is there a way to clear all of those connections to troubleshoot?
I did try setting up a connection pool, but got the same errors.
Thanks!