Upgrading the Orthanc PostgreSQL plugin across schema revisions

Upgrading the Orthanc PostgreSQL plugin changes the database the whole archive depends on, so the work is planned around backups, a tested copy of production data and a rollback point. This page covers what changes, the upgrade sequence and what drives effort.

On this page

Why upgrading the Orthanc PostgreSQL plugin needs its own plan

Upgrading the Orthanc PostgreSQL plugin is not a file replacement. The plugin records its schema revision in the database, and on first start a newer release may migrate that revision in several steps. A team that copies new binaries over the old ones and restarts can leave an archive half migrated or unable to start, with no clean way back. The plugin is a separate component from the Orthanc core and from the PostgreSQL server itself. Each one has its own version, its own compatibility range and its own upgrade path, so a change to one does not settle the others.

For an archive holding patient images, that risk is a clinical and governance issue, not only an availability issue. The index in PostgreSQL is what lets clinicians find studies, and a failed migration can make stored images look missing even when the files are intact. Before you change anything, confirm the target pairing: check which Orthanc core version and which PostgreSQL plugin version the release notes name together, using the Orthanc NEWS file as the record of each release. The core line in view here includes Orthanc 1.13.0, released on 2026-08-15. Do not assume that a newer core works with an older plugin, or the reverse, until the notes say so.

Then rehearse the move on a copy. Restore a recent backup into a separate database, point a test instance at it, start the new plugin version and watch the migration logs from start to finish. Record how long the first start took, confirm that studies query and retrieve correctly, and only then schedule the production change. Keep the original database and the previous plugin files until the upgraded system has run under real load. The rollback options, including any downgrade script the project provides for your target version, should be confirmed in the release documentation before the production window is set.

What changes in a PostgreSQL plugin revision and what each change means

This table compares the changes you may meet when moving the Orthanc PostgreSQL plugin to a new release, with the impact of each and the action your team needs to take. Read each row before scheduling the upgrade, and confirm the exact changes for each revision in its release notes, since the supplied facts do not list plugin revision details.

ChangeImpactAction needed
Revision tableRecords the schema version the database is at, so Orthanc knows which migration steps are still pending.Read the current revision value before upgrading and record it in your change log for rollback planning.
Automatic multi-step migrationsMoving across several revisions can apply more than one schema step in a single start, and each step changes stored data.Check the release notes for every revision between your current and target version, then test the full path on a copy of the database.
Long first start on large databasesThe first start after a schema change can run for an extended period on a large index, so Orthanc appears unavailable.Estimate duration from a test run on a copy of production data, and schedule a maintenance window with margin.
Autohealing during and after migrationAutohealing can run checks or repairs on the index while the migration is still settling, which can confuse results or extend startup.Disable autohealing for the upgrade as documented for your revision, then re-enable it after you verify the database state.
Downgrade scriptsDowngrade scripts are not guaranteed for every revision, so rolling back may require restoring a backup instead.Confirm whether your target revision ships a downgrade script, and take a verified backup before the upgrade regardless.
Multi-instance accessSince Orthanc 1.9.2 with PostgreSQL plugin 4.0, several instances can read and write one database, so an old instance may run against a new schema.Stop every instance that uses the database, or confirm each one runs the matching plugin version, before applying schema changes.

Startup decides whether the database migrates before Orthanc runs

The diagram starts when Orthanc loads the new PostgreSQL plugin, which reads the revision table in the database. If the stored revision is behind the plugin, the plugin applies each intermediate revision in order, then checks the autohealing setting before Orthanc starts. A failed step stops startup with an error and leads to a rollback decision point. At that point you choose between restoring a backup and running a downgrade script, and you should confirm which one your revision set supports before you begin the upgrade.

Startup path of a plugin upgrade, with autohealing and rollback decision points.

What to prepare before the first start on the new plugin

The first start of a new PostgreSQL plugin revision can run schema migrations on a live archive, so the preparation is mostly about being able to undo the change. The cards below cover the backup, the inventory, the test copy, the window, the rollback owners and the observation you need in place before any instance starts.

Verified PostgreSQL backup with Orthanc stopped

Stop every Orthanc instance that writes to the database, then take a PostgreSQL backup that you have actually restored once on a separate server. A backup taken while instances are still writing may not match the DICOM files on storage, and a backup you have never restored is only a hope. Record the backup time, size and checksum, and confirm that the DICOM storage area was captured or versioned alongside it.

PostgreSQL archiving docs

Inventory of versions and configuration

Record the exact plugin version you run now, the Orthanc core version, the full configuration file and any Lua, Python or Java scripts that read or write the index. Compare these with the target plugin release notes, because a plugin revision may require a matching core version. Keep a copy of the current configuration so that a rollback restores the same settings the previous plugin expected.

Staging copy sized for migration time

Build a staging database from a recent copy of production data and run the new plugin against it before you touch production. Measure how long the first start takes and watch for long-running schema steps. Ask the vendor or Orthanc Team whether the migration is chained across several revisions, because each step adds time, and size the test against your largest archive rather than a sample.

Maintenance window agreed with clinical users

Agree a maintenance window in writing with radiology, referring clinics and anyone who sends images through modalities or viewers. A long first start means Orthanc is unavailable for reads and new stores, so the window must cover the measured staging time plus a margin for checks. Confirm how modalities will queue or retry during the outage and who will tell them when the service is back.

Rollback plan with named owners

Write the rollback steps before the upgrade: which backup to restore, which plugin and core versions to reinstall, and what happens to any data stored after the migration. Name one person who decides to roll back, one who executes it and one who confirms service with clinical users. Downgrade scripts exist for some revisions, but confirm their availability for your exact versions before you rely on them.

Monitoring and log access for the first start

Before the first start, make sure the team can read Orthanc logs and PostgreSQL logs live, and that CPU, memory, disk and lock metrics are visible on the database host. Assign one person to watch these during the migration and to stop the upgrade if progress stalls or errors repeat. Confirm where logs go in your deployment, because a container restart can discard logs that were not forwarded.

How the plugin upgrade runs, step by step

This sequence moves the Orthanc PostgreSQL plugin to a new revision with a tested backup, a timed first start on a copy of production data, and a controlled rollout that proves one instance is healthy before the rest of the cluster follows.

  1. Freeze the target versions

    Record the Orthanc core version, the PostgreSQL plugin version and the schema revision you are moving to, along with the current revision in the database's revision table. Read the plugin release notes and its migration notes for the target revision, and confirm with the plugin documentation whether any migration step requires autohealing to be disabled and, if so, its exact setting name. Your change record should name the rollback target, which is the current plugin build plus a verified backup. The output is a written version matrix that everyone on the change agrees to before staging work starts.

  2. Restore the production backup to staging

    Restore a recent production backup of the Orthanc PostgreSQL database and the matching DICOM storage into a staging environment that mirrors production's Orthanc and PostgreSQL versions, configuration and storage layout. Keep staging isolated from modalities, PACS peers and clinical users so test traffic cannot reach real systems. The check is that the restored database opens on the current plugin version, the revision table matches production, and the staging Orthanc instance answers its REST API before any upgrade is attempted.

  3. Run the upgrade on staging and time the first start

    Deploy the target plugin build to the staging Orthanc, start it, and watch the migration log from the first line to the point where Orthanc reports it is serving requests. Migrations can run several steps in sequence, and a large index can make the first start much longer than later starts, so record the wall-clock time and the revision reached. Use that measured time to plan the production maintenance window with your own numbers rather than any published estimate. The output is a staging log with the start and finish times and the final revision.

  4. Verify study counts and queries

    Compare the number of patients, studies, series and instances in the staging database against the pre-upgrade counts taken from production. Run the query and retrieve operations your users and modalities depend on, including C-FIND, C-MOVE or C-STORE where you use them, and the REST endpoints your viewers call. Check a sample of studies end to end by opening them in the viewer. The check passes when counts match and every test query returns the expected results. Any mismatch stops the production plan until the cause is understood.

  5. Plan the production stop

    Agree the production maintenance window with clinical and operations owners, and list every system that writes to or reads from the Orthanc database, including other Orthanc instances, housekeeping jobs and scheduled transfers. Stop inbound DICOM traffic and writers in a defined order so no instance is still writing when the migration starts. Confirm who can authorize a rollback during the window and what the rollback decision point is, based on the staging timings you measured.

  6. Take a final backup

    With all writers stopped, take a fresh backup of the PostgreSQL database and a copy of the DICOM storage, then verify that the backup can be restored. Record the revision table, the Orthanc and plugin versions and the file checksums or storage inventory in the change log. This backup is your rollback point: if the migration fails, you restore it and start the previous plugin build. The check is a successful test restore of the backup on a separate host, not only a completed backup job.

  7. Deploy the new plugin and start one instance

    Deploy the new plugin build to a single production Orthanc instance, start it and watch the migration log until the revision reaches the target and the instance reports healthy. Confirm that the revision table shows the expected revision and that a sample query and a sample store succeed. Keep the other instances stopped while this runs. The output is a healthy first instance with a saved migration log, which is the evidence needed before anything else is started.

  8. Bring other instances up after the first is healthy

    Once the first instance has passed its checks, deploy the same plugin build to the remaining instances and start them one at a time, confirming each one reports healthy before moving on. Re-run the study count comparison and a few end-to-end queries after the last instance is up, and then reopen inbound DICOM traffic. Keep the rollback procedure available until clinical and operations owners sign off that the upgrade is complete.

What makes a plugin upgrade take longer or cost more

This table lists the factors that change how long a PostgreSQL plugin upgrade takes and how much work the written scope covers. Read each row alongside the question to ask for, because the quote follows from the scope you agree on, not from a list price. The main takeaway is that database size, the number of shared instances and the availability you need usually matter more than the plugin itself.

DriverWhy it mattersWhat to ask for
Database size and instance countMigration steps that rewrite or re-index tables take longer as the index grows. Orthanc's own FAQ notes that the PostgreSQL plugin is recommended once an archive reaches several hundred thousand instances, and large production sites hold far more.Current instance count, study and series counts, total database size, and a timed test migration on a copy of the production database.
Number of revisions between current and targetThe plugin applies revision steps in sequence, so a jump across several releases means more migration work and more points where a step can fail.The list of revisions between your current and target version, and whether the plugin's automatic steps are tested for each jump.
Customizations in scripts or pluginsLua, Python or Java scripts and other plugins that read the index directly may break after a schema change and need retesting before cutover.An inventory of scripts, plugins and external tools that touch the database, with a retest plan for each.
Number of Orthanc instances sharing the databaseAll instances on one database must stop, upgrade and restart together during a schema change, so more instances mean more coordination and a longer window.The instance list, the shutdown and restart runbook, and who coordinates the window across teams.
Restore and staging timeA staging environment needs a restored copy of production before any test is meaningful. Restore time scales with data volume and often becomes the longest single step.Backup format, restore method, measured restore time on representative hardware, and staging sign-off criteria.
Availability needs for clinical useClinical image access may not tolerate a long first start. The plugin's migration runs before Orthanc serves requests, so the downtime window is set by the database size and the number of steps.The acceptable downtime window in writing, the rollback point, and whether a hot backup is taken before the upgrade.
PostgreSQL server versionPostgreSQL 14 is supported until November 12, 2026 (PostgreSQL versioning policy). A server upgrade planned in the same window adds a second change to test and roll back.Current PostgreSQL major version, the planned end-of-support date, and whether the server upgrade is scoped in the same engagement or separately.
Rollback requirementsDowngrade scripts are not a guaranteed path back. A rollback may depend on a backup taken before the first start of the new version.Written rollback procedure, the backup used for it, and the test evidence that the rollback works on a copy.

Choosing a rollback path when a migration fails

When the new plugin fails during its first start, the schema may be partly migrated, so the first question is whether the database can return to its pre-upgrade state at all. Automatic migrations run in several steps, and a long first start on a large database can be interrupted by a timeout, a stopped container or a full disk. Users have not yet returned, so little or no post-upgrade data exists.

  • Restore the pre-upgrade backup: the most predictable option. Restore the backup taken before the window opened, then confirm the revision table reports the old revision before starting the old plugin.
  • Run a downgrade script: only if the target revision provides one. Confirm in its release notes which revisions it reverts and whether it has been tested on a database interrupted mid-migration.
  • Keep the old plugin on a copy: start the previous plugin against a copy of the database so the production original is not altered during diagnosis.
  • Data at risk: very little, since no user writes have been accepted. The main risk is a partially migrated database that neither plugin version starts against.
  • Confirm whether an interrupted migration can be rerun: check how the migration behaves after interruption and time it on a restored copy of your own database.

Check that the backup restores to a database the old plugin starts against, and rehearse that restore before the window opens.

Questions teams ask before upgrading the Orthanc PostgreSQL plugin

How long does an Orthanc PostgreSQL plugin upgrade take?

The duration depends mainly on how many instances and studies the database holds and how many schema revisions the upgrade crosses. The plugin applies its migrations automatically and in sequence, so a jump across several revisions takes longer than a single step, and the first start on a large database can run for a long time because the migration rewrites index data. Measure your own database before planning: count instances and studies, check free disk space for the copy you take before migrating, and run the upgrade on a restored copy in a test environment to get a figure from your own hardware. Ask any partner to base its schedule on that test run, not on a generic number.

Can our own team upgrade the PostgreSQL plugin without outside help?

A team with working PostgreSQL and Orthanc administration skills can usually perform the upgrade alone, provided it has a staging copy of production data, a tested backup and a written rollback plan. The risky parts are the first start on a large database, the decision to disable autohealing before migration, and recovery if a migration stops partway. Teams without someone who has done this before often bring in a partner for the planning, the rehearsal and the runbook, then run the production step themselves. Your scope decides which of these you need.

What do we need from our database, Orthanc and clinical staff?

The work needs three groups to commit time. Database administrators confirm backup and restore procedures, storage capacity, connection handling and who can run the migration. Orthanc administrators confirm the current plugin and core versions, the configuration file, and whether several Orthanc instances share the database, since they must all stop before the schema changes. Clinical and operations contacts agree on a maintenance window, communicate downtime to modalities and referring sites, and approve the test results. Name one owner for each group before the work starts.

What drives the cost of an upgrade and what should we ask for in a quote?

Cost follows the scope: the number of environments, the size of the database, the number of Orthanc instances, the number of schema revisions to cross, and how much testing and documentation you want. Most of the spend is one-time work (assessment, staging rehearsal, runbook and the production window), while any ongoing support or retesting after later releases recurs. DeployOpen does not publish prices and quotes from a written scope. Ask for a fixed scope listing environments, deliverables, the rehearsal and rollback steps, what is excluded, and who performs each action. Ask Orthanc Team SRL separately if you want its own dedicated support hours, which it quotes on request.

Is a downgrade always possible after a plugin schema upgrade?

No, a downgrade is not guaranteed. Schema migrations can change or drop data structures, and the project provides downgrade scripts only for some revisions, so you must check the release notes for the exact versions you are moving between. The reliable rollback is a full backup taken before the upgrade, restored together with the matching plugin and core versions. Test that restore in staging before production, and keep the old plugin binaries available until the new version has run successfully for an agreed period.

Can we upgrade the plugin and PostgreSQL major version in the same window?

You can, but it doubles the risk and the number of things that can fail, so most teams separate the two. The plugin migration changes Orthanc's schema, while a PostgreSQL major upgrade changes the server's storage format and requires a dump and restore, pg_upgrade, or logical replication. Doing both together means a failure has two possible causes and two rollback paths. Complete and validate one change, then the other, unless your rehearsal shows that the combined window fits your downtime limits. The PostgreSQL upgrade should follow its own plan, documented in the separate PostgreSQL upgrade topic.

How DeployOpen scopes and delivers a plugin upgrade

DeployOpen plans upgrades of the Orthanc PostgreSQL plugin as fixed-scope work inside your own infrastructure, starting from the revision your database is on and the release you intend to reach. Each step is tested on a copy of your data before any change touches the production index.

How we scope

  • Record the current plugin release, Orthanc core version, and the revision table state of each database.
  • Map every schema revision between the current and target release, including any steps that will run automatically.
  • Agree in writing the rollback approach, downtime window, and whether autohealing will be disabled during the change.

How we build

  • Restore a recent backup to a separate PostgreSQL instance and run the full migration path there first.
  • Time the first start on that copy so the long initial migration on your real database can be planned in advance.
  • Test downgrade scripts against the copy and record which steps are reversible and which need a restore from backup.

How we hand over

  • Deliver a runbook with the exact order of stop, backup, upgrade, restart, and verification steps for your environment.
  • Document the test results, observed migration durations, and the configuration changes made during the upgrade.
  • Walk your operations team through the runbook so they can repeat it for the next revision without us.

How we support

  • Engagements are fixed-scope, with scope, deliverables, and timelines agreed in writing before work starts.
  • Ongoing support, upgrades, and continuous testing are available as a retainer if you want us to handle later revisions.
  • Confirm with your team which PostgreSQL server version and Orthanc release you will run before scoping begins.

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.