Migrating Orthanc from SQLite to PostgreSQL without re-ingesting

A growing Orthanc archive outgrows its built-in SQLite index. This page explains when the move is due, which documented route avoids re-ingesting studies, and what downtime and verification work to plan.

On this page

What an Orthanc SQLite to PostgreSQL migration changes and what stays

The move replaces the index database, and it can leave the stored DICOM files where they are. A team whose Orthanc archive keeps growing on the built-in SQLite index is really holding two separate parts: the index, which records patients, studies, series and instances and answers every query, and the files, the DICOM objects written to the storage area. A migration to PostgreSQL moves the index into a database server you operate, through the PostgreSQL plugin. The Advanced Storage plugin route described on this page is designed so the files stay in place while the index is rebuilt against the new database, which avoids re-ingesting studies from modalities. Whether that route fits depends on three things you should measure before any work starts: how many instances the archive holds, how long clinical users can tolerate the server being unavailable, and how you will prove afterwards that nothing was lost.

The page covers three parts of that work: when a move from SQLite becomes due, how the Advanced Storage plugin is used to re-index existing files into PostgreSQL, and the downtime and verification planning around the cutover. The database engine itself is a separate decision. PostgreSQL is released under the PostgreSQL License, and its supported major versions and end-of-support dates are published on the versioning policy page, so the target version should be chosen against that schedule rather than the version you happen to have on hand. Confirm with your own team which PostgreSQL version your platform standard supports before you size the server.

Two things remain unchanged and deserve explicit sign-off. The DICOM files, and any study identifiers and access rules that depend on them, are expected to survive the index change, so the archive's content is not what you are migrating. The Orthanc version, the plugins in use and the network configuration are also upgrade and deployment questions in their own right, and mixing them into the same change window makes failures hard to attribute. Ask the team that operates the archive to write down the expected instance and study counts from the current SQLite index now, because those counts are the baseline that verification will be checked against later.

Which SQLite index features map cleanly to PostgreSQL

This table compares what the built-in SQLite index holds with what the PostgreSQL plugin provides, so you can see which items carry over as they are and which need a test in your own version. Treat any row marked as a test as a checkpoint for the rehearsal, not as an assumption. The main takeaway is that the study, series and instance hierarchy is the core of the move, while configuration, plugin settings and multi-instance behavior need explicit verification.

FeatureSQLite indexPostgreSQL plugin and what to check
Patient, study, series and instance hierarchyStored in the built-in SQLite index with DICOM identifiers and parent linksHeld in PostgreSQL tables with the same hierarchy; confirm the counts per level after migration
Patient and study metadata lookupsIndexed DICOM tags used by the REST API and Orthanc Explorer 2 searchesSame tags are indexed; test your most used searches and sort orders against the source server
Attachments and file referencesPointers from the index to files in the storage areaAttachment records move with the index; verify that each instance still resolves to a stored file
Instance counts and study totalsCounts reported by the REST API and statistics routesCompare counts before and after; a mismatch is a stop condition, not a cosmetic issue
Server configuration and usersSet in orthanc.json and the RegisteredUsers list, separate from the indexNot moved by the database change; you must update the database plugin settings and re-check authentication
Multi-instance access to one databaseSingle Orthanc process owns the indexFrom Orthanc 1.9.2 with plugins 4.0, several instances can read and write the same database; confirm your exact plugin and core versions first
Plugins, scripts and custom triggersDepend on the index through the REST API and eventsTest each Lua, Python or Java script and any authorization plugin after the switch, because behavior is not assumed to be identical

When the SQLite index is due for replacement

The Orthanc documentation states that the built-in SQLite index should be replaced by an enterprise database engine once the server stores several hundred thousand DICOM instances, and it recommends the PostgreSQL plugin for large datasets. Treat that figure as the point where the question must be answered, not as a switch to flip on a date. Count your instances now through the REST API or your storage reports, then record how that number grows each month. If you are heading toward the threshold within the planning horizon of your next maintenance window, start the migration design now, because the work involves storage decisions and a cutover that take longer to plan than to run.

The instance count alone rarely forces the move. Watch for three other signals. First, more than one Orthanc instance needs to read and write the same index. SQLite is a file on local disk, and the scalability documentation ties multi-instance access, horizontal scaling and high availability to the PostgreSQL and MySQL plugins, so a second node or a planned failover pushes the decision forward. Second, slow index queries in your own logs or in modality and viewer response times indicate the index is working harder than it should. Third, backup windows that no longer fit your schedule matter, because the index and the files must be backed up consistently. Confirm with your Orthanc team which of these signals applies to your environment before you commit to a timeline.

Measure before you decide. Time a representative set of C-FIND and REST queries against production-sized data, note how long your current backup takes, and list every system that depends on Orthanc being available. If none of the signals above is present and the count is well below the documented threshold, the better answer may be to keep SQLite and revisit the decision at a set review date. If one or more signals is present, the next step is to size the PostgreSQL server and choose a high availability approach, since PostgreSQL does not detect a failed primary or promote a standby on its own.

Which documented paths move the index without re-ingesting

Four routes can carry an existing Orthanc archive off the SQLite index, and each one depends on different assets being intact. The choice turns on whether the DICOM files stay in place, whether the database engine is the goal, and how much recovery effort you are willing to plan for. Confirm each route against the Orthanc version you run before you commit to a window.

Advanced Storage plugin rebuild

The Advanced Storage plugin can index files that already sit in a storage area, so the existing DICOM files do not have to be sent through ingestion again. Confirm with the Orthanc Team that the plugin version you plan to use supports rebuilding the index from your current storage layout, and that it works with the PostgreSQL plugin you intend to target. Ask how it handles studies stored as compressed or transcoded files, and how long it runs against your instance count. Test on a copy of the archive first, and keep the SQLite database until the counts match.

Scalability FAQ

PostgreSQL plugin as target

The PostgreSQL plugin is the back end the Orthanc documentation recommends for large datasets, and it lets several Orthanc instances share one database. Before you switch, confirm which plugin release matches your Orthanc core version, and check the PostgreSQL server version it supports. Plan the database user, schema ownership and connection limits up front, since the index is rebuilt into that schema. Treat the plugin as the destination of the migration, not as a route that moves data on its own.

Orthanc plugins

Full re-ingest over DICOM or REST

If the index cannot be rebuilt from storage, the fallback is to send every study back into a new Orthanc instance through DICOM C-STORE or the REST API. This route avoids depending on old index files but is usually the slowest and needs network capacity for the full archive. Ask your team to estimate transfer time from your own throughput tests, not from published figures. Keep the source server online until study and instance counts match on the target.

PostgreSQL backup and recovery tools

Standard PostgreSQL tools protect the database itself, so a failed index move can be rolled back without losing the new schema. Logical dumps, base backups with point-in-time recovery, and tested restores each cover a different failure, and they are separate from the Orthanc storage area. Confirm the backup tooling and retention you need with your database team, and restore a backup to a separate server before the cutover. These tools do not rebuild the DICOM index on their own.

PITR documentation

Verify counts before retiring SQLite

Every route above ends with a comparison of studies, series and instances between the old SQLite index and the new database. Agree the counting method in writing before the move, so both sides are measured the same way. Keep the SQLite file read-only and archived until the comparison passes and clinical users confirm that their studies open. Ask the Orthanc Team which REST counters they recommend for this check on your version.

How the index, the file storage and the PostgreSQL database fit together

The diagram starts with the running Orthanc instance, which keeps its index in a SQLite file and its DICOM files in a storage area. The Advanced Storage plugin route reads the existing files and builds the new index in PostgreSQL, so the files stay where they are. A backup point sits before cutover, and the decision path shows the due-check that leads there. Check that the PostgreSQL server sits behind the database network boundary and that counts match before switching.

Index, file storage and PostgreSQL during the move, with the decision path to cutover.

How to run an Orthanc SQLite to PostgreSQL migration in phases

The sequence moves a growing Orthanc index from SQLite to PostgreSQL in stages, so each step leaves a verified state and a rollback point before the live archive changes.

  1. Inventory instances, storage and plugins

    Your team exports a count of stored instances, studies and series from the current Orthanc, records the Orthanc version, the Docker image or package in use, the enabled plugins and the storage layout on disk or in object storage. DeployOpen reviews the inventory with you to confirm which plugins and configuration keys must change and which versions of Orthanc and the PostgreSQL plugin are compatible. The step is done when you hold a signed-off inventory that both teams use as the baseline for every later count check. Confirm version compatibility with the Orthanc Book and the release notes before you pick target versions.

  2. Stand up the target PostgreSQL server

    Your platform or database team provisions a PostgreSQL server in infrastructure you control, choosing a major version that is still within its support window at the planned go-live date. DeployOpen installs the Orthanc PostgreSQL plugin on a test host, creates the database and role with least privilege, and confirms that the plugin starts against the empty database. Backups, high availability and connection handling are decided here, not later. The step is done when an empty Orthanc instance on the new database starts cleanly and the backup job has restored successfully into a scratch database at least once.

  3. Pilot the migration on a copy of the archive

    Your team takes a copy of the production index and storage, or a representative subset with the same plugins, and runs the Advanced Storage plugin route on it so that existing studies are indexed in PostgreSQL without being re-ingested from modalities. DeployOpen records every error, the time taken and the resource use, and checks whether any study, series or instance is missing or altered. The pilot shows which settings must change for the full run. The step is done when a pilot run completes with a written list of issues and their fixes, and the counts in the copy match the source index.

  4. Run the parallel verification

    The migrated index is brought up beside the live SQLite instance on the same storage, with DICOM and REST traffic kept on the old server while your team compares results. DeployOpen runs scripted count checks on studies, series and instances, samples retrieved files by checksum, and compares sample queries from your viewers and modalities. Any gap is traced to its source before the next step. The step is done when two consecutive comparison runs show identical counts and sampled files match, and the findings are documented with an owner for each open item.

  5. Plan the cutover window and rollback point

    Your team agrees a change window with clinical and operations stakeholders, freezes new ingestion for its duration and names the people who can call a rollback. DeployOpen writes the runbook: stop writes, take a final backup of the SQLite index and configuration, run the last incremental sync, switch the configuration to PostgreSQL, start the service and run the verification checks again. The rollback point is the retained SQLite index and the configuration file that points to it, kept unchanged until the decommissioning step. The step is done when the runbook has been rehearsed on the pilot copy and the rollback steps have been tested.

  6. Execute the cutover and confirm services

    During the agreed window, your team stops ingestion, applies the final sync and switches the Orthanc configuration to the PostgreSQL index. DeployOpen checks that viewers, modality connections and any DICOMweb clients reach the new instance, and repeats the count and sample checks against production. If a check fails and cannot be fixed within the window, the team uses the rollback runbook and returns to the SQLite index. The step is done when all checks pass against production, the service has accepted new test ingestion and the change record is signed by both teams.

  7. Decommission the SQLite index after counts match

    After a monitoring period agreed in advance, your team archives the SQLite index file with its backup and removes it from active use only once production counts continue to match the baseline inventory. DeployOpen updates the configuration documentation, the backup policy and the upgrade plan so that they refer only to PostgreSQL. The step is done when the final count reconciliation is recorded, the archived SQLite file is stored under your retention policy and the rollback option is formally closed.

What drives the cost and duration of an Orthanc SQLite to PostgreSQL migration

This table lists the factors that change the effort and cost of moving an Orthanc index from SQLite to PostgreSQL, and whether each one is paid once or recurs. Use it to scope a written quote, since the same move can differ widely depending on the rows in the table. Figures are not given here because they depend on your own environment and must come from a written scope.

DriverWhy it changes effortOne-time or recurringWhat to ask for in a quote
Instance and study countThe Orthanc docs suggest moving off SQLite once several hundred thousand instances are stored, so larger indexes mean longer import and verification runs.One-timeStated counts of instances, studies and series, and how the index will be copied and checked
Total storage volumeLarge file stores take longer to validate, and the Advanced Storage route keeps files in place, so volume affects checks more than copying.One-timeStorage size per back end and the method used to verify file presence
Storage back end (local disk or object storage)Local disk paths need to remain reachable from the new setup, while object storage adds credentials, endpoints and hybrid-mode steps.One-time, with ongoing storage charges on your sideConfirmed storage location, access method and whether a storage move is in the same project
Number of Orthanc instances and connected modalities or viewersEach instance, modality and viewer must be re-pointed and tested, and multi-instance setups need shared database access.One-time for re-pointing, recurring if the cluster is maintainedInventory of instances, DICOM peers and viewers, and the test plan for each
Allowed downtimeShorter windows usually require a dry run, a cutover checklist and a rollback path, which adds preparation work.One-timeAgreed outage window, rollback criteria and who approves the cutover
PostgreSQL server ownership and high availabilityUsing a server you already run is less work than provisioning one, but replication, failover tooling and backups add scope, since PostgreSQL does not detect primary failure by itself.Setup is one-time, operation is recurringWho owns the server, HA design, backup and restore testing, and support hours after cutover
Verification depthCount checks, sample file reads and full reconciliation against the source index differ greatly in effort.One-time for the migration, recurring if audits repeat itNamed checks, sample sizes, evidence format and acceptance criteria

How to verify study and instance counts after cutover

The verification goal is simple to state: the new PostgreSQL index must describe the same studies, series and instances as the SQLite index it replaces, and every study must still be retrievable. Start by counting studies, series and instances per source (per partition or per storage area, if you use more than one) on the old and new indexes, and record the counts in a signed comparison. Any mismatch should be explained before cutover sign-off, not averaged away. Ask the team doing the migration to confirm which counting queries they will run against each database, because a count taken through the REST API and a count taken directly from the database tables can differ if deleted or pending items are treated differently.

Counts alone do not prove identity. Pick a sample of patients and studies, including some with unusual characters in names, multiple series and old ingestion dates, and compare patient and study identifiers field by field between the two indexes. Then test retrieval end to end: fetch sample studies through the REST API and through DICOM C-MOVE or C-GET from the modalities and PACS that depend on this server, and confirm the instance data matches what is stored. Illustrative example: if a sample of studies from one storage area returns full series through the API but a DICOM retrieve from a remote PACS fails, the index is wrong or the peer configuration is, and both need checking before sign-off.

Keep the SQLite index as a read-only fallback until the team signs off, and record how long that fallback stays in place as a decision, not a default. Test PostgreSQL backups and point-in-time recovery on the new database before it becomes the only copy of the index, by restoring to a separate host and repeating the count and retrieval checks on the restored copy. Confirm the recovery procedure against the PostgreSQL continuous archiving documentation and your own backup tooling, and write down who can trigger a restore and what the team must check afterwards.

What usually goes wrong during an Orthanc database move and how to prevent it

A move from the SQLite index to PostgreSQL touches the database, the storage that holds the DICOM files, and every route that can reach them. The risks below cluster around three questions: whether the old and new indexes can drift apart, whether you can recover if cutover fails, and whether the instance is exposed while it is being changed.

Running both databases at once

Pointing some Orthanc instances at SQLite and others at PostgreSQL, or letting a test copy write to the production database, splits the record of what is stored. Studies uploaded during the window may appear in one index and not the other. Before any cutover, confirm which instance is the single writer, stop or freeze the SQLite instance, and keep the old index as a read-only fallback rather than a live second writer.

Counts checked too late or not at all

Teams often confirm that Orthanc starts and that a few studies open, then discover missing instances weeks later. Record study, series and instance counts from the SQLite index and the storage folder before the move, then compare the same counts afterwards and sample a set of studies for pixel-level retrieval. Agree the acceptance criteria in writing before the migration window opens.

No verified backup before cutover

A failed index migration with no tested copy of the SQLite database and the DICOM storage can leave the archive unreadable. Take a backup of the SQLite index file and the storage area, confirm that the backup restores into a separate Orthanc instance, and record the restore steps. Treat the backup as part of the rollback plan, not an optional step.

PostgreSQL version outside support

Choosing a PostgreSQL major version that has passed or is near end of support puts the archive on a database that will stop receiving security fixes. The supported versions at the time of writing are 14 to 18, with 14 ending November 12, 2026 and 18 ending November 14, 2030. Confirm the chosen version against the versioning policy and check Orthanc plugin compatibility before installing it.

PostgreSQL versioning policy

Database or Orthanc exposed without authentication

Opening the PostgreSQL port beyond the Orthanc host, or enabling remote access to Orthanc without users and HTTPS, exposes patient images during a window when the setup is still changing. Keep PostgreSQL on a private network with client authentication, and keep Orthanc on localhost or behind a reverse proxy with authentication enabled and HTTPS in place before any remote access is allowed.

Dangerous routes left enabled

The execute-script route can run system commands and the export route can overwrite files. Leaving either enabled during a migration, when operators are scripting and copying files by hand, widens the attack surface. Disable both routes before the migration starts, confirm they return an error from every client, and re-enable only with a documented need after the move is verified.

Orthanc security FAQ

Questions buyers ask about an Orthanc SQLite to PostgreSQL migration

What does an Orthanc SQLite to PostgreSQL migration cost?

No price is published for this work, and a quote follows from a written scope. The main cost components are the migration engineering itself, the PostgreSQL server you run (its hardware or cloud instance, storage, backups and monitoring), and any change to the Orthanc plugin set and test environment. The biggest drivers are the number of instances and studies to be indexed, whether the Advanced Storage plugin route is used, how many systems point at Orthanc, and how much rehearsal your change board requires. Hosting and backup costs recur every month, while the migration engineering is one-time. Ask any vendor, DeployOpen included, to split the quote into one-time and recurring items and to state which environments are covered.

How long does moving Orthanc from SQLite to PostgreSQL take?

The window depends on how much work sits between your current index and a verified cutover, not on a fixed number of days. The factors that set it are index size, the size of the storage area that must be indexed or left untouched, the number of Orthanc instances sharing the database, how much testing is needed in a non-production copy, and whether your downtime tolerance allows a short outage or requires a longer planned one. Orthanc's own documentation says the built-in SQLite index should be replaced once an instance stores several hundred thousand DICOM instances, so larger archives generally need more rehearsal. Ask for a timeline in the written scope that lists each rehearsal and the cutover window.

Do Orthanc studies have to be re-ingested during a PostgreSQL migration?

Not necessarily. The route covered on this page uses the Advanced Storage plugin so that DICOM files already in the storage area can be reindexed into the new database rather than sent again from modalities. Re-ingesting means every study passes back through DICOM transfer, which costs network time, risks duplicates and adds load on modalities and PACS. Whether the file-based route works for your archive depends on where the files sit, how they are named and whether they are already in the layout Orthanc expects. Confirm this in a rehearsal on a copy of your data before committing to a plan.

What must our team provide before a PostgreSQL migration starts?

The migration needs access and information that only your team can supply. Typical items are a current Orthanc version and plugin inventory, the configuration files, the SQLite database and storage area location, a list of connected modalities, PACS, viewers and automated scripts, and a copy of the data or a test host that mirrors production. You will also need a PostgreSQL server you control, with network access from Orthanc, backup and monitoring arrangements, and a named owner for the cutover decision. Agree in writing who approves a maintenance window and who signs off that study counts match before the old index is retired.

Can our own imaging or platform team run the migration without a partner?

Often yes, if the team has Orthanc administration experience, PostgreSQL operations skills and a test environment in which to rehearse. Your team carries the knowledge of your modalities, viewers and clinical workflows, which a partner will need from you anyway. A partner adds the most value where the rehearsal, verification and rollback plan need outside review, or where the team has no spare capacity during a change window. Compare the cost of your staff time, including rehearsal and post-cutover checks, against a fixed-scope engagement. DeployOpen plans, implements and verifies these migrations inside your infrastructure, and its engagements are agreed in writing before work starts.

What happens to viewers and modalities during the cutover?

During the cutover, Orthanc is stopped or set to refuse new work while its index moves, so modalities that send studies and viewers that query or retrieve them may see errors or delays. The exact impact depends on how Orthanc is reached, whether it is behind a reverse proxy, and whether modalities retry automatically. Plan a clear window, tell clinical users when viewers will be unavailable, and confirm that each modality's retry behavior is acceptable. After the switch, test query, retrieve, store and viewer access, and confirm that counts for studies, series and instances match the pre-migration values before reopening traffic.

How DeployOpen scopes and delivers an Orthanc database migration

DeployOpen approaches moving Orthanc from SQLite to PostgreSQL as a planned change to the index behind a live archive, not a simple configuration swap. The work starts with a written scope that covers your Orthanc version, study volumes, storage layout and downtime window, then moves through a tested build, a documented cutover and ongoing support in infrastructure you control.

How we scope

  • Written scope that records current Orthanc version, instance count and whether files sit on local disk or object storage
  • Review of the database, storage and plugin configuration to confirm the Advanced Storage route fits your archive
  • Agreed downtime window, rollback criteria and count reconciliation method, all written down before work starts
  • Engagements are fixed-scope, so deliverables and timelines are agreed in writing before any migration work begins

How we build

  • PostgreSQL server and Orthanc PostgreSQL plugin deployed in a non-production copy of your environment first
  • Test migration run against a copy of the SQLite index, with counts of patients, studies, series and instances compared
  • Connection, authentication and backup settings reviewed on the PostgreSQL side before any production cutover
  • Rehearsal of the cutover steps and rollback path, timed against the agreed downtime window

How we hand over

  • Runbook covering the cutover steps, configuration changes, verification queries and rollback procedure
  • Count reconciliation report comparing source and target before and after the switch, with any differences explained
  • Configuration files, plugin versions and PostgreSQL settings documented for your own operations team
  • Knowledge transfer session so your staff can run the backup and restore routine without DeployOpen present

How we support

  • Post-cutover check period scoped in the written agreement to confirm indexing, storage access and backups behave as expected
  • Ongoing support, upgrades and continuous testing available as a retainer for Orthanc and the PostgreSQL server
  • Help planning future Orthanc core upgrades and PostgreSQL major version moves, including test runs before production
  • Confirm with DeployOpen during scoping which PostgreSQL version, backup tooling and high availability approach your environment requires

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.