Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Heroku Engineering 7 min read How-to mediumAdept

Heroku Postgres Upgrade Guide: Simplify Your Move to Version 17

Postgres 17 is now available on Heroku Postgres, along with five new `heroku pg:upgrade:*` CLI subcommands (prepare, run, cancel, dryrun, wait) that expose Heroku's internal upgrade automation for self-service major-version upgrades. Essential-tier databases upgrade with a single `pg:upgrade:run`. Standard-tier and higher databases can do an optional dry run on a follower, then schedule the upgrade for the next maintenance window or trigger it manually. The upgrade runs in place via an internal replica, takes about 5-10 minutes of downtime, upgrades followers automatically and keeps `DATABASE_URL` unchanged. The legacy `pg:upgrade` command is being deprecated, though the follower-based flow remains available for teams that want easier rollback.

Related posts

  • Why Does Everyone Run Ancient Postgres Versions?

    Neon easyNovice

    Many teams stay on old Postgres major versions because older releases already meet most needs and major upgrades are costly: they can break backward compatibility and usually require logical replication, incremental table migration, testing and a planned cutover. Knock (11 to 15) and Retool (9 to 13, 4 TB) both followed that pattern, including separate publications with copy_data = false for large append-only tables and feature-flagged traffic switching. Reasons to upgrade anyway include the five-year support lifecycle, the growing difficulty of skipping many versions, performance gains such as roughly halved tail latency since version 8, and ecosystem compatibility. The pgversions.com tool lists the security fixes, bug fixes and features a given version is missing.

  • How we migrate TBs from Heroku without logical replication

    PlanetScale mediumAdept

    PlanetScale's open-source Heroku Migrator moves multi-terabyte Postgres databases off Heroku standard plans, which lack WAL access and logical replication, by using Bucardo trigger-based replication: triggers record changes in delta tables, a one-time COPY loads existing data, and a worker replays the backlog before a controlled switchover with verification. Version 2.0 fixes failures seen on large migrations. Bucardo's single-transaction initial copy restarted from zero after any interruption, so the migrator now drops secondary indexes before the copy and rebuilds them in parallel afterwards, raising throughput from about 60 to nearly 300 GB/h. It also disables transaction_timeout on Bucardo's connections, sets TCP keepalives so silently dropped long-lived connections fail within about a minute, and tunes host TCP buffers. A discovery CLI and the Liftoff assessment flag tables without primary keys, incompatible extensions and sizing before the migration starts.

  • Postgres 17 is Now Available on Neon

    Neon mediumAdept

    Postgres 17 is available on Neon for all plans, including Free, and can be provisioned in a few steps. The post walks through new PG17 features with runnable SQL: MERGE with RETURNING and merge_action(), random(min, max) for generating test data, JSON_TABLE for turning JSON into relational rows, the sslnegotiation=direct connection parameter, and EXPLAIN reporting planner memory usage. Neon's proxy supports direct SSL negotiation even for older server versions, which cut a sample psql connection from 0.87s to 0.75s. Major version upgrades on Neon still require manual steps and a check of extension compatibility.

  • How To Set Up a Staging Environment on Heroku in 3 Easy Steps

    Heroku Engineering mediumAdept

    Heroku pipelines let you put a staging app in front of production: disable auto-deploy on production, create a pipeline with a new staging app auto-deploying from GitHub, and optionally enable Review Apps per pull request. Staging should be isolated per Twelve-Factor principles, with separate config vars and its own Postgres database. That database is either built from migrations via the release phase and app.json postdeploy scripts, or copied from production with the destructive pg:copy when the data is not sensitive. Promotion copies the already-compiled slug to production rather than rebuilding, so verified code runs unchanged and rollbacks are fast, though database migrations must be rolled back separately.

  • Introducing Neon Labs

    Neon mediumAdept

    Neon Labs launches with two experimental tools for major Postgres version upgrades on Neon, where pg_upgrade isn't supported and an upgrade means migrating into a new project. The Upgrade Assessment runs read-only pg_catalog queries and flags blockers such as unsupported extensions, PG15 public-schema permission changes, PG17 search_path restrictions, PG18 virtual generated columns, and tables lacking replica identity. The Migration Assistant picks Import (<10 GB), pg_dump/pg_restore (10–200 GB) or logical replication for larger databases. For replication it handles schema copy, lag and slot-activity monitoring, sequence resets to avoid post-cutover duplicate keys, and running ANALYZE on the target before traffic arrives, since pg_statistic isn't carried over.

The quest for software engineering knowledge.

Look:
Layout: