title: Heroku “psql: FATAL: remaining connection slots are reserved for non-replication superuser connections”
body: <p>I got the above error message running Heroku Postgres Basic (<a href="https://stackoverflow.com/questions/11847144/heroku-psql-fatal-remaining-connection-slots-are-reserved-for-non-replication">as per this question</a>) and have been trying to diagnose the problem.</p>
  
  <p>One of the suggestions is to use connection pooling but it seems <a href="https://stackoverflow.com/questions/5826381/is-there-any-reason-to-use-a-database-connection-pool-with-activerecord">Rails has this built in</a>.  Another suggestion is that the app is configured improperly and opens too many connections.</p>
  
  <p>My app manages all it's connections through Active Record, and I had one direct connection to the database from Navicat (or at least I thought I had).</p>
  
  <p>How would I debug this?  </p>
  
  <p><strong>RESOLUTION</strong></p>
  
  <p>Turns out it was an Heroku issue.  From Heroku support:</p>
  
  <blockquote>
    <p>We've detected an issue on the server running your Basic database.
    While we pinpoint this and address it, we would recommend you
    provision a new Basic database and migrate over with PGBackups as
    detailed here:
    <a href="https://devcenter.heroku.com/articles/upgrade-heroku-postgres-with-pgbackups" rel="noreferrer">https://devcenter.heroku.com/articles/upgrade-heroku-postgres-with-pgbackups</a>
    . That should put your database on a new server. I apologize for this
    disruption – we're working to fix this issue and prevent it from
    occurring in the future.</p>
  </blockquote>