Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to restart postgres on Heroku?

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?

like image 360
Martin Avatar asked Jul 07 '13 21:07

Martin


1 Answers

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
like image 92
catsby Avatar answered Sep 21 '22 08:09

catsby