The plans of the Premium and Enterprise tier comes with the High Availability feature. This feature involves a cluster database and a management system to increase availability in case of failure.
When the database fails, it is automatically replaced by another. To determine that a failure occurred, Heroku starts a series of checks. This process can take up to 2 minutes. Because of the continuous protection mechanism, Heroku minimizes data loss, usually to 160 MB or 10 minutes, whichever is less.
When the recovery process finishes, new access credentials are generated and the database URL is changed. Finally the Heroku application is restarted with the new access data to the database.