Is there any way to restart postgres on Heroku?

heroku, postgresql

Solution

No, you cannot restart your Postgres database on Heroku. If you have lingering connections, it's likely an app issue. Try in stalling the pg-extras plugin and looking for `IDLE` connections:

- https://github.com/heroku/heroku-pg-extras

Also, you can try setting up a custom ActiveRecord connection in your `after_fork` block and enabling the connection reaper, which should clean up any lingering dead connections it finds:

- https://devcenter.heroku.com/articles/concurrency-and-database-connections

Problem

I deploy a Rails app using Unicorn. After every deployment and after every tweak I do to the `DB_POOL` I see postgres still hold some connections as idle and new changes are very inconsistently making me wondering If is restarting at all the service after every pool change. I haven't found any documentation regarding this. Is there any similar command to pg_ctl on Heroku?

Original source