Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with Postgres starter tier

I recently moved to Postgres and am getting intermittent errors of the form:

PGError: FATAL:  terminating connection due to administrator command
SSL connection has been closed unexpectedly: 
        SELECT a.attname, format_type(a.atttypid, a.atttypmod), 
               d.adsrc, a.attnotnull
          FROM pg_attribute a LEFT JOIN pg_attrdef d
            ON a.attrelid = d.adrelid AND a.attnum = d.adnum
         WHERE a.attrelid = '"xxxxxx"'::regclass
           AND a.attnum > 0 AND NOT a.attisdropped
         ORDER BY a.attnum

vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.11/lib/active_record/
connection_adapters/postgresql_adapter.rb:505:in `exec'

What can I do to get around this (apart from going back to the old Postgres Addon, which is a temporary solution I suppose).

like image 638
baldmark Avatar asked Aug 10 '12 10:08

baldmark


People also ask

Is Heroku Postgres good?

Heroku Postgres offers a number of different plans, each of which provides the highest security standards. Ultimately, Heroku Postgres is a great option for any developer looking to build, scale, or maintain their databases without having to take infrastructure into consideration.

When using the PG upgrade to upgrade to version 13 how much app downtime is required?

If no --version flag is set, the upgrade will default to 14. Performing a pg:upgrade requires app downtime on the order of 30 minutes.

What version of Postgres does heroku use?

For Hobby plans, all newly provisioned databases will default to PostgreSQL 14.

Is Heroku Postgres encrypted at rest?

All production plans (Standard, Premium, Private and Shield) are encrypted at rest with AES-256, block-level storage encryption.


1 Answers

Ideally your app should be transparently coping with database errors by re-trying its work without bugging the user. If an idle DB backend is shut down from under it, it shouldn't care, it should just make a new connection and start the transaction again. I don't know how practical Rails and ActiveRecord makes that though.

See also the question What's the cause of "PGError: FATAL: terminating connection due to administrator command" on heroku?.

It seems that Heroku will kill sometimes backends and restart servers when they're doing maintenance, which might explain your issues if your use is very infrequent.

like image 98
Craig Ringer Avatar answered Sep 23 '22 14:09

Craig Ringer