Upgrading Your PostgreSQL Version

Render currently supports PostgreSQL major versions 12 through 16 (along with version 11 for existing accounts that are currently running it).

You select your database’s major version at creation time, after which it cannot be changed without migrating to a new instance.

Minor version updates

Render periodically upgrades your database’s minor PostgreSQL version to apply the latest security fixes. Whenever one of these updates requires downtime, we notify you ahead of time via email. From the Render Dashboard, you can then schedule your preferred maintenance window or trigger the maintenance manually.

Migrating to a new major version

This process often requires downtime for some of your applications. Schedule accordingly.

These are the high-level steps for moving your data to a PostgreSQL database with a higher major version:

  1. Create a new database with the desired version.
  2. Disable or suspend any applications that write to your existing database.
    • This guarantees that you can take an up-to-date backup of your existing database.
  3. Take a backup of your existing database.
  4. Restore the backup to your new database.
  5. Point all of your applications at the new database. Re-enable the applications that perform writes.

However, before you complete the above, we recommend attempting a “dry run” by performing just these steps:

  1. Create a new database with the desired version.
  2. Take a backup of your existing database.
  3. Restore the backup to your new database.

The dry run enables you to confirm whether a full migration will succeed, and it doesn’t require suspending or modifying any of your applications.

Taking a backup

If your existing database uses a Standard instance type or higher, you can trigger a backup directly from your database’s Recovery page in the Render Dashboard:

List of backups in the Render Dashboard

Otherwise, you can take a backup using pg_dump. This command dumps your database to a local file (make sure to swap out the appropriate database variables, as well as the hostname for Frankfurt region databases):

PGPASSWORD={PASSWORD} pg_dump -h oregon-postgres.render.com -U {DATABASE_USER} {DATABASE_NAME} \
   -n public --no-owner > database_dump.sql

You can then restore this data to your new database:

PGPASSWORD={PASSWORD} psql -h oregon-postgres.render.com -U {DATABASE_USER} {DATABASE_NAME} < database_dump.sql

If you have multiple databases in your PostgreSQL instance, repeat the steps above for each database you want to migrate. Alternatively, you can use pg_dumpall to automatically back up all databases in your instance.

For more details on this process, see PostgreSQL Backups and Recovery.

Troubleshooting

If certain statements fail to execute due to a version incompatibility, you might need to manually modify your database dump to resolve these issues. Review the changelogs for each PostgreSQL version ahead of time to identify any such incompatibilities and their resolutions: