PostgreSQL major version upgrades for self-hosted Medplum

A PostgreSQL major upgrade is a separate project from a Medplum release, and on AWS RDS it is a manual one. This page explains the options, the rehearsal and rollback points, and how the work fits around Medplum's own upgrade path.

On this page

Why a PostgreSQL major version upgrade for Medplum needs its own plan

If your self-hosted Medplum database still runs an older PostgreSQL major version, the support window is now the deciding factor. PostgreSQL 14 support ends November 12, 2026, so teams that have deferred this work are now planning it under a deadline. A PostgreSQL major upgrade is not part of a Medplum server upgrade. The Medplum server, its Redis cache and the PostgreSQL cluster each move on their own schedule, and a Medplum release does not move the database for you. Medplum's self-hosting best practices state that PostgreSQL major version upgrades need manual planning and that AWS does not perform them automatically for RDS. Preparation, testing and execution typically take several days of focused effort, so the work needs an owner and a calendar slot before it starts.

The first decision is the target version. Check the database versions listed in the release notes for the specific Medplum version you plan to run after the upgrade, because a PostgreSQL version that is current on the PostgreSQL site may not be one Medplum supports yet. Then confirm the sequence with your Medplum server upgrade path. Medplum requires each minor version to be applied in order, so the database change must be scheduled so it does not collide with a post-deploy migration or a rollback window. Ask your team which Medplum version is running now, which version the database must support at the end, and whether any of the intermediate releases change database requirements.

Start with an inventory that a reviewer can check: the current PostgreSQL version, the extensions in use, the connection pooling layer such as PgBouncer, backup and point-in-time recovery settings, and every replica or standby. Each of these changes the method you choose and the downtime you can accept. Confirm with your database administrator and your Medplum deployment owner who signs off on the rehearsal results and the cutover window, and write those names into the plan before any production change is scheduled.

What changes between PostgreSQL 14 and 18 for Medplum

This table compares the PostgreSQL 14 and 18 changes that affect a self-hosted Medplum database, with the effect of each change and the check to run in staging before cutover. Read each row as a question to answer against your own cluster, and treat the staging check as the gate before the production window is booked.

ChangeImpact on a Medplum databaseAction needed in staging
PostgreSQL 14 support ends November 12, 2026A cluster still on 14 will run without community security fixes after that date, which leaves the database outside the supported line during the planned window.Confirm the target date for cutover against this deadline and record the planned end-of-support exposure in the change plan.
PostgreSQL 18 first released September 25, 2025, final release supported until November 14, 2030Targeting 18 gives the longest support runway of the supported majors, so the upgrade is less likely to need repeating soon.Confirm that your managed or packaged PostgreSQL offering provides 18 before you commit to it as the target.
Minor releases never change the storage formatMinor updates within 14 or 18 only replace executables and restart, so they do not require a data conversion step.Apply the latest minor on the source version first so the major upgrade starts from a patched baseline.
pg_upgrade retains planner statistics in 18Query plans are less likely to degrade immediately after cutover because statistics carry over rather than being rebuilt from scratch.Compare key query timings after cutover and still run ANALYZE if your tooling does not carry statistics for your setup.
pg_upgrade adds parallel jobs and a --swap option in 18Parallel jobs can shorten the data conversion window, and --swap can reduce the time spent moving data files into place.Measure conversion time on a copy of production data and confirm the job count and swap behavior with your Medplum DBA.
Asynchronous I/O in 18Read-heavy FHIR search and Medplum's background work may behave differently under load, which changes baseline performance.Rerun representative search and post-deploy migration workloads and compare against the 14 baseline.
OAuth 2.0 authentication method in 18Applies only if you use OAuth for database logins. Medplum's own authentication does not depend on this database method.Review pg_hba.conf entries and confirm whether any client connects with OAuth before enabling it.
uuidv7() function in 18Adds a time-ordered UUID generator, which affects new IDs only if your own SQL or extensions call it. Existing rows are unchanged.Search your custom SQL and extensions for uuidv7() usage and confirm nothing depends on a new default.
Virtual generated columns by default in 18Generated column definitions in your schema may change storage behavior, which can affect reporting queries or custom views built on them.Inspect generated columns in the schema dump and test any reports or exports that read them.
MD5 password authentication deprecated in favor of SCRAMRoles that still authenticate with MD5 will need password hashing updated, or connections from the Medplum server and any reporting tools can fail.Confirm every role uses SCRAM, reset passwords where needed, and test the Medplum server, PgBouncer and BI connections.

Why AWS RDS does not perform the major version upgrade for you

Medplum's self-hosting best practices state that AWS does not automatically perform major version upgrades for RDS, so the team running a self-hosted Medplum database has to schedule, rehearse and execute the change itself. Minor PostgreSQL updates are a different matter: they replace executables and restart the instance, and the storage format does not change. A major upgrade (for example, 15 to 16) changes the on-disk format and requires a separate method such as dump and restore, pg_upgrade, or logical replication. The method you choose sets the length of the downtime window, so that choice belongs in the plan before any date is set.

On a Medplum stack deployed with the AWS CDK, the database is an RDS PostgreSQL instance that the server reaches through its connection settings, and the same CDK stack may define one or more reader instances. A major upgrade touches the writer and every reader, and the application must reconnect cleanly afterward. Confirm the exact steps for your stack with your infrastructure team, including which CDK parameters and connection values change and whether the server needs a restart. Also confirm that the target PostgreSQL major version is supported by the Medplum release you run. Medplum's upgrade guidance sets the order of Medplum version steps, so the database target should be checked against that release, not chosen from the PostgreSQL calendar alone.

Treat the database upgrade as its own change with a named owner, a rollback decision and a staging rehearsal on a copy of production data. Ask your AWS and Medplum contacts which PostgreSQL versions are validated for the release you are moving to, and record the answer in the change plan. Also confirm how long your largest data migration is expected to run, because a database upgrade that coincides with a Medplum post-deploy migration will compound the time you need. Keeping the database change separate from the application change lets each one be reversed on its own terms.

How the database upgrade phases fit around a Medplum release

The database track starts with an inventory of the current PostgreSQL version and the Medplum target, then moves through a staging copy and a rehearsal of the chosen method. A go or no-go decision gates the production cutover, after which the team validates Medplum against the new database. The Medplum minor upgrade sequence runs in its own lane, so the database change and the server change are scheduled as separate events. Keep the old cluster until the rollback decision point has passed.

Database and Medplum server upgrades run as distinct, sequenced events.

Choosing between pg_dumpall, pg_upgrade and logical replication

The dump and restore method uses pg_dumpall to export every database, role and global object from the old cluster as SQL, then loads that output into a fresh cluster running the new major version. It is the simplest method to reason about because the new cluster is built from scratch and the dump is a complete, replayable record of the data. The cost is time: the source is generally kept read-only while the dump runs, and the restore rebuilds every index and constraint, so downtime grows with the size of the database.

  • Downtime driver: total dump time plus restore time, which scales with data volume and index count.
  • Staging requirement: a full timed rehearsal on a copy of production data, including the role and extension restore.
  • Dump scope: pg_dumpall captures cluster-wide objects, so confirm that roles, tablespaces and extension versions match the target.
  • Rollback path: the old cluster stays intact until cutover, which makes fallback straightforward if the rehearsal is clean.
  • Operational skill: low, since the steps are sequential and there is no replication state to monitor.

Before committing, confirm the measured dump and restore time from staging fits the maintenance window your Medplum users can accept.

What to prepare before a PostgreSQL major version upgrade

Preparation decides whether a major upgrade is a controlled change or an outage with a rollback plan written during the incident. The six items below cover recovery, inventory, rehearsal, dependencies, rollback and communication, and each one feeds the staging rehearsal that comes before any production work.

Verified backup and restore test

A backup only counts once a restore has succeeded on a separate cluster. Restore a recent base backup, then confirm the Medplum server starts against it and that record counts and recent resources match expectations. Plan point-in-time recovery from archived WAL so you can return to a moment just before the upgrade started. Confirm retention covers the rollback window, not just the typical restore need. Ask your PostgreSQL operator or cloud provider exactly which continuous archiving settings are active.

Continuous archiving docs

Extension, authentication and pooler inventory

List every extension installed in the database, the authentication methods in pg_hba.conf or the managed equivalent, and any connection pooler in front of the cluster, such as PgBouncer. Each extension must exist, and be compatible, in the target major version before you start. Authentication methods and pooler settings often change behavior across versions, so record them now. Confirm which application and Medplum connections go through the pooler.

PgBouncer project

Staging environment with a production copy

Build a staging database sized close to production and load a recent copy of production data. Staging should run the same Medplum server version, the same instance class class where feasible, and the same network path. Use it to measure how long the upgrade and any post-upgrade statistics refresh take, and to find queries that slow down. Results from an empty or small staging database rarely predict production timing.

Database-dependent Medplum and application settings

Record every Medplum server setting, environment variable and application configuration that depends on the database version or its behavior, including connection string options, SSL and SCRAM password settings, and any queries or extensions your bots and integrations use. Confirm each one against the Medplum self-hosting docs for the version you run. Changes found here belong in the staging plan, not in production troubleshooting.

Medplum upgrading guide

Rollback plan with the old cluster intact

Decide the rollback method before the upgrade starts. If you use pg_upgrade without the swap approach, the old data directory remains usable only until the new cluster accepts writes. Logical replication keeps the old cluster as a source you can switch back to, but it needs reverse replication planned in advance. Keep the old cluster intact until validation is complete, and write down the trigger conditions for returning to it.

Downtime tolerance and named owners

Set the downtime you can accept in writing and name one owner for each decision: the go or no-go call, the database changes, Medplum application checks, client communication and rollback authority. Logical replication can limit the write outage to several seconds, while a dump and restore may take far longer on a large database. Agree that rehearsal timings, not estimates, set the change window.

Logical replication downtime
Several seconds
PostgreSQL upgrading docs

How to run the PostgreSQL major version upgrade in sequence

The sequence confirms the version pairing, proves the restore and the method in staging, and then moves production through a cutover with a held rollback point, so each change can be stopped or reversed at a known state.

  1. Confirm the target versions together

    Before any change, the platform owner and the Medplum administrator agree on two targets: the PostgreSQL major version and the Medplum release that will run against it. Check the PostgreSQL support dates for the current and target major versions, and confirm in Medplum's upgrading guide and release notes which Medplum minor is the next stop on the current line. Confirm the Medplum minor does not require a sequence of stops that conflicts with the database window. The step is done when both versions are written into the change record with their support end dates. Rollback point: nothing has changed yet, so the team can drop the plan at no cost.

  2. Back up and prove the restore

    The database owner takes a full backup of the production cluster and confirms that it can be restored into an isolated environment. Verify the restore by starting the restored cluster, checking row counts on the largest FHIR tables, and confirming the Medplum server can connect to it. If you use point-in-time recovery, confirm that WAL archiving is running and that you can restore to a chosen time. The step is done when a restore has succeeded in a separate environment and the team has recorded how long it took. Rollback point: production is unchanged, and this backup is the fallback for every later step.

  3. Rehearse in staging with a production-sized copy

    Build a staging cluster from a recent production-sized copy and run the full procedure on it, including the upgrade method, the Medplum restart or repoint, and the validation checks. Time each phase separately: backup, data transfer or dump, the upgrade itself, statistics or analyze work, and the application restart. Record the observed timings, because Medplum's best practices expect preparation, testing and execution to take several days of focused effort, and your own timings set the production window. The step is done when one complete rehearsal has passed every check in the later steps and the timings are written down. Rollback point: staging is disposable, so any failed rehearsal can be repeated from the restore.

  4. Freeze schema changes and confirm the method

    Stop all schema changes, including Medplum migrations, index work and any change to the database owned by other applications, from the start of the rehearsal to the end of the rollback window. Confirm the chosen method (pg_dumpall with restore, pg_upgrade, or logical replication) against the rehearsal results and the downtime the business accepts. Logical replication allows a cutover with only several seconds of downtime according to PostgreSQL's documentation, but it needs its own validation of replicated objects. The step is done when the change record names the method, the freeze window and the owner of each decision. Rollback point: the freeze can be lifted at any time before the production cutover begins.

  5. Run the chosen upgrade method on production

    During the approved window, the database owner runs the method exactly as rehearsed, watching each timed phase against the staging figures. Stop and call a decision point if a phase runs well beyond the rehearsal timing. Keep the original cluster intact and stopped from writes rather than deleted, so it remains the rollback target. Do not combine a Medplum minor upgrade with this change unless that exact combination has been rehearsed. The step is done when the new cluster accepts connections and the server reports the expected version and row counts match the pre-upgrade record. Rollback point: while the old cluster is intact, repointing the application back to it is the reversal.

  6. Repoint Medplum and the connection pooler

    Update the database host and any connection pooler configuration, such as PgBouncer, to point at the new cluster, then restart the Medplum server processes. Confirm that the pooler is routing to the new version and that connection limits match the rehearsed configuration. Check the Medplum logs for startup errors and confirm the server starts cleanly against the new version. The step is done when every Medplum server instance and pooler node is connected to the new cluster and no instance is still reading from the old one. Rollback point: repointing the configuration back to the old cluster, provided no writes have landed only on the new cluster that have not been reconciled.

  7. Validate FHIR, authentication and background jobs

    Run a scripted set of checks: create, read and update a test resource through the FHIR API, run a search and a GraphQL query, sign in through each identity provider in use including MFA where enabled, and confirm that client credentials still issue tokens. Then confirm that background jobs and Subscriptions run, including any async jobs Medplum queued after the restart. Compare the results with the staging checks. The step is done when every check in the written list passes and a named clinical or operations owner signs off. Rollback point: any failed check that touches data integrity is a reason to repoint to the old cluster before users return.

  8. Hold the old cluster for a defined rollback window

    Keep the old cluster running, stopped from accepting application writes, for a rollback window the team agreed in step one. Record the window's end time in the change record and document the conditions for rolling back, such as data mismatches or failed checks. Monitor error rates and database health through the window. The step is done when the window closes without a rollback decision and the owner records that the old cluster is no longer needed for rollback. Rollback point: the old cluster remains the fallback until this window closes.

  9. Decommission the old cluster

    After the window closes, take a final backup of the old cluster for retention under your policy, then remove it from the network and delete its compute and storage according to the agreed retention schedule. Update the runbook, monitoring, backup jobs and capacity records so they reference only the new version. Confirm that no scheduled job, pooler entry or replica still points at the old host. The step is done when the inventory shows only the new cluster and the change record is closed. Rollback point: after decommissioning, restoring from the final backup is the only path back, so confirm retention before deletion.

What makes a PostgreSQL upgrade on Medplum take longer

This table lists the factors that change how much work a PostgreSQL major upgrade needs for a self-hosted Medplum database. Read each row as a question to answer about your own environment before estimating effort. Effort and duration should come from a rehearsal on a copy of your data, because no published figure reflects your dataset or cutover constraints.

DriverEffect on effortWhat to check
Database sizeDump and restore, or logical replication catch-up, grows with the amount of data and the number of indexes to rebuildCurrent database size, largest tables, index sizes, and the time a full restore took in a staging rehearsal
Acceptable downtimeA short cutover through logical replication needs more preparation than an offline dump and restore windowThe maximum outage your clinical and integration users can tolerate, and who approves it
Read replicas and high availabilityEach standby or replica must be upgraded, resynchronized or rebuilt, adding steps and failover checks to the cutoverNumber of standbys, replication mode (synchronous or asynchronous), and the failover tool in use
Extensions and custom SQLExtensions must support the target major version, and custom functions, views or triggers may need changesInstalled extensions and their target-version availability, plus any custom database objects outside Medplum's schema
Connection poolers and application settingsPoolers such as PgBouncer, connection strings and authentication settings may need to point to the new cluster and match its authentication methodPooler configuration, connection limits, password encryption method, and where credentials are stored
Number of environments to rehearseEach environment needs its own rehearsal, so effort scales with the count of development, staging, disaster recovery and production copiesWhich environments hold realistic data, which are kept in sync, and the order in which they will be upgraded
Medplum upgrade cadence and post-deploy migrationsA database upgrade that overlaps a Medplum minor upgrade or a running background migration widens the change window and complicates rollbackThe target Medplum version, pending post-deploy migrations, and whether the database change is scheduled separately from application changes

How much effort does a PostgreSQL major version upgrade take for Medplum?

How many days of effort does a PostgreSQL major upgrade for Medplum take?

Medplum's own best practices describe preparation, testing and execution of a PostgreSQL major version upgrade as typically taking several days of focused effort. That is a baseline, not a quote. The actual effort depends on database size, how many environments need a rehearsal, how many applications and Bots connect to the database, whether extensions or custom SQL need checking, and how many people must approve each step. Teams with a tested staging copy and a rehearsed runbook usually spend less time than teams starting from a blank plan. Ask any partner to show the phases, the people needed in each and the environments included before accepting a figure.

Can our own team upgrade the Medplum database without a partner?

Yes, if the team has someone comfortable with PostgreSQL administration, backup and restore, replication and cloud networking, plus someone who knows the Medplum server configuration and deployment tooling. The work includes reading the PostgreSQL upgrade documentation, choosing a method, rehearsing on a staging copy, testing application behavior against the new version, and writing a rollback plan. Teams without a dedicated database administrator often find the rehearsal and rollback planning take the most time. Confirm internal capacity for the staging cycle and the change window before deciding.

What does our team need to provide for a PostgreSQL upgrade engagement?

The client typically provides access to the AWS account or data center where the database runs, a staging copy of the database with realistic data volumes, and a test environment that matches production configuration. They also approve downtime, name an owner for the database, one for the Medplum server, and one for application and clinical sign-off, and set a change window with a rollback decision point. Access should be scoped to the systems involved, and any production data copied to staging should follow your privacy and access controls. Confirm these items in writing before work begins.

How is the downtime method for a PostgreSQL major upgrade chosen?

The method follows from how much downtime the organization can accept. PostgreSQL documents three approaches: dump and restore with pg_dumpall, pg_upgrade, and logical replication. Dump and restore is the simplest to reason about but needs the longest outage on large databases. pg_upgrade is faster and, in PostgreSQL 18, retains planner statistics and adds parallel jobs and a --swap option. Logical replication works across major versions and can limit downtime to several seconds, but it adds setup, monitoring and cutover steps. Measure restore and upgrade time on the staging copy, then compare each method against the approved window.

Can the PostgreSQL upgrade and a Medplum minor upgrade share one window?

They can, but combining them multiplies the risk, because a failure becomes harder to attribute to the database or the application. Medplum's upgrading guide requires self-hosted servers to move through each minor version in sequence, and some post-deploy data migrations can run for hours or days on large datasets. A database major upgrade on the same night means a second rollback path at the same time. Most teams separate the two changes, validate the database on the current Medplum version first, and then plan Medplum minors around the post-deploy migration schedule. Confirm the target PostgreSQL version is supported by the Medplum release you run before scheduling.

What should a written quote for a PostgreSQL major upgrade include?

A written quote should list the current and target PostgreSQL versions, the Medplum version and its supported database versions, the chosen upgrade method and why, the environments covered, and the staging rehearsals counted. It should name the deliverables, such as the runbook, rollback procedure, verification queries, and post-upgrade monitoring notes. It should state the client responsibilities listed above, the assumptions about database size and downtime, what is excluded, such as application changes or post-deploy migration monitoring, and the retest or support after cutover. Ask whether the price is fixed, how change requests are handled, and what recurring support costs apply.

How DeployOpen scopes and delivers a PostgreSQL upgrade for Medplum

DeployOpen plans a PostgreSQL major version upgrade for a self-hosted Medplum database as a written, fixed-scope engagement inside your own infrastructure. The work is scoped against your current PostgreSQL version, Medplum release line, downtime tolerance and rollback needs before any change is made to a production database.

How we scope

  • Inventory the current PostgreSQL major version, Medplum server version and the upgrade path between them
  • Agree in writing which upgrade method is in scope, such as pg_upgrade, dump and restore, or logical replication
  • Define downtime tolerance, rollback window and the staging environments that must mirror production

How we build

  • Rehearse the upgrade on a staging copy of the database and record each step and its measured duration
  • Test Medplum server startup, post-deploy migrations and key FHIR API flows against the upgraded database
  • Prepare backup, restore and cutover runbooks, including the checks that confirm the database is ready to serve

How we hand over

  • Deliver a written runbook with commands, configuration changes, verification queries and rollback steps
  • Document how the PostgreSQL upgrade was sequenced with the Medplum minor version upgrades around it
  • Walk your operations and database teams through the runbook and leave them with the evidence from rehearsals

How we support

  • Offer ongoing support, upgrades and continuous testing for your PostgreSQL and Medplum estate as a retainer
  • Plan the next PostgreSQL minor and major upgrades against the PostgreSQL support end dates for your version
  • Retest the database and Medplum configuration after future upgrades to confirm the earlier evidence still holds

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.