Skip to content

Remove IEX console Postrex too many connections

Nathan Willson edited this page Nov 3, 2021 · 2 revisions

Solution: kill all the connections using heroku pg:killall

You can preview the current connections using a dataclip

SELECT * FROM pg_stat_activity;

If there's an ip address you want to kill (ip address listed in the result from above), then run:

SELECT pg_terminate_backend(pid), host(client_addr) 
FROM pg_stat_activity 
WHERE host(client_addr) = 'IP ADDRESS HERE';

Helpful resource:

https://stackoverflow.com/questions/19814740/heroku-postgres-too-many-connections-how-do-i-kill-these-connections

Clone this wiki locally