Synapse background database updates after an upgrade

A Synapse upgrade can start cleanly and still leave database work running for days on a large homeserver. This page explains how background updates are batched and throttled, what changes between releases, and how to plan the upgrade so those updates finish before the next one.

On this page

Why a Synapse upgrade is not finished at restart

A Synapse server can restart on a new release, pass its health checks and serve clients normally while schema work is still queued. A Synapse upgrade is not complete at restart: the remaining database changes run as background updates after the process is up, and the next release can depend on them having finished. Teams usually upgrade to pick up security fixes, keep pace with supported Python and PostgreSQL floors, or stay within a reachable path to a newer release. Each of those reasons only holds if the server reaches the target version with its database in a state the next step expects.

The supported path runs through the Synapse upgrade notes, which describe the schema changes and required actions for each release. Read every set of notes between your current version and the target, not only the newest one, because a skipped release can carry a change that later releases assume has already happened. The notes also warn that rolling back can be difficult because of schema changes, so the point at which a change is applied is a rollback decision as much as a technical one. Ask your vendor or internal platform owner to confirm which versions your server must pass through before you start.

Background update timing therefore belongs in the upgrade plan, not in a post-upgrade checklist. Batch size and sleep interval are configurable through the background_updates settings, and the defaults in the Synapse configuration manual determine how quickly a large database catches up. On a large database, the queue can take longer to drain than the gap between two planned releases. Before scheduling the next upgrade, check whether background updates have finished on the current server and record how long they took, so the change window and the rollback point are based on evidence from your own environment.

What changes between Synapse releases and what each change means

This table compares the release changes that affect a Synapse upgrade and what each one asks of your team. Read each row as a check to run before you start: the platform floors must be met first, and the schema and background update rows decide how carefully you plan the restart and any rollback. The main takeaway is that a restart does not finish the upgrade on a large database.

ChangeImpactAction needed
PostgreSQL 14 or newer required from 1.143.0Releases from 1.143.0 will not run on older PostgreSQL, so an old database server blocks the upgrade.Confirm the PostgreSQL major version before you upgrade, and plan a major upgrade first if needed.
Python 3.10 or newer required from 1.142.0The Synapse host or container must provide a newer Python runtime for these releases.Check the Python version on every host or image that runs Synapse and its workers.
Schema changes between releasesRolling back can be difficult because the database schema may have changed, so a restored older binary may not match the data.Take a verified database backup before the upgrade and treat rollback as a restore plan, not a binary swap.
Background database updates continue after restartSome schema work runs in the background after Synapse restarts, so the new release can start while the database is still being updated.Watch background update progress after the restart and do not begin the next upgrade until it finishes.
Dropped support at upstream end of lifeSynapse stops supporting a Python or PostgreSQL version once it reaches upstream end of life, so a later release may require a newer platform.Track upstream end-of-life dates for your Python and PostgreSQL versions and schedule platform upgrades ahead of Synapse releases.
Multi-version upgradesSkipping releases can cross several schema changes at once, which increases rollback difficulty and background work.Read the upgrade notes for every version you pass and upgrade in the order the notes describe.

How the upgrade phases and background updates fit together

The diagram starts at the backup and shutdown steps, then passes through the new release, the first start on the changed schema, and the background update batches. The rollback decision sits before that first start, because rolling back after the schema changes is difficult according to the upgrade notes. Before the next release, check that background updates have finished, using the Synapse admin tooling you have confirmed for your version. Only then should the next upgrade begin.

Upgrade phases, the rollback gate, and the background update loop against the database.

What to prepare before the upgrade starts

Background database updates run against the data you already have, so the time an upgrade takes depends on the database, the configuration and the platform underneath it. The cards below cover the items to confirm before anyone stops the homeserver, each with the team member who should own it.

Tested database backup and restore

Take a full PostgreSQL backup and restore it to a separate host before the upgrade starts. Rolling back a Synapse release can be difficult because schema changes between releases are not always reversible, so a restore you have already rehearsed is the realistic fallback. Confirm the restore time, the media store that goes with it, and that the restored instance starts with the previous Synapse version. The database administrator owns this check, with the platform lead signing off.

Synapse upgrade notes

Local configuration and overrides inventory

List every setting in homeserver.yaml and any included files that touches background updates, including any background_updates block. Defaults run a batch of 100 with a 100 ms run and a 1000 ms sleep, and a local override changes how fast the work finishes. Record the values in production so the team can compare them after the upgrade. The Synapse administrator owns this inventory and keeps it with the change record.

Synapse configuration manual

Production-sized test copy

Restore a copy of the production database into a staging environment with similar hardware and run the upgrade there first. Measure how long the background updates take, which tables they touch, and whether the homeserver stays responsive while they run. A copy that is much smaller than production will understate the work. Ask the staging owner to confirm the data volume matches production within a margin the team agrees on in writing.

PostgreSQL version against the floor

Check the running PostgreSQL major version against the Synapse floor. Synapse 1.143.0 and later require PostgreSQL 14 or newer, and PostgreSQL 14 reaches end of support in November 2026. If the cluster runs an older major version, plan that upgrade as a separate change before the Synapse upgrade. The database administrator confirms the version with a query against the live server, not from the installation record.

PostgreSQL versioning policy

Python and dependency checks

Confirm the Python interpreter and the packages installed in the Synapse virtual environment or container image. Synapse 1.142.0 and later require Python 3.10 or newer, and packages pinned in older environments can conflict with the new release. Check the release notes for the target version and rebuild the environment in staging rather than patching the production host in place. The platform engineer who builds the Synapse image owns this item.

Worker and Redis layout record

Write down which worker processes run, which worker types they use, which stream writers are configured, and how Redis is deployed. Background updates run in the main process or a designated worker, so a layout change during the upgrade can shift where the work happens. Keep the record next to the configuration inventory so the team can confirm after the restart that every process came back in the same form. The team that runs the worker layout owns this record.

Synapse workers docs

Planning background updates by database situation

A small homeserver with a modest room history usually finishes background updates within the defaults, so the main work is confirming that they do finish. The Synapse configuration manual gives the defaults as a 100 ms run duration per batch, sleep enabled at a 1000 ms interval, a minimum batch size of 1 and a default batch size of 100. In a test environment, restore a recent copy of the database, start the upgraded Synapse, and watch the background update progress until it reports no remaining work.

  • Measure the elapsed time: Record how long the updates take on a restored copy so you have a baseline for the next release.
  • Keep the defaults first: Change nothing until a measured run shows the updates are too slow to finish between releases.
  • Watch the logs during startup: Confirm the server runs normally while updates continue in the background.
  • Avoid unplanned tuning: Raising batch size on a small production server adds load without a clear benefit and makes rollback harder to reason about.
  • Record the settings: Keep a copy of the background_updates block in version control so later changes are traceable.

Before the production upgrade, confirm that the restored test run finished and that the timing fits your maintenance window. Confirm current values in the configuration manual before you change any setting.

How to run the Synapse upgrade step by step

This sequence moves a Synapse homeserver to a new release without losing the ability to roll back at the points that matter. It also confirms that background database updates from the new release finish before anyone plans the next upgrade.

  1. Read every upgrade note in the range

    The operator who owns the homeserver reads the Synapse upgrade notes for every release between the current version and the target, not only the target. Each note is checked for schema changes, configuration changes, removed options and platform floor changes, and the findings are written into a change record that names the current and target versions. The step is done when the change record lists every breaking item and an owner for each one. Where the notes describe a schema change that needs an intermediate release, the operator plans those stops now. Confirm the exact sequence against the official upgrade documentation before proceeding.

  2. Rehearse the upgrade on a test copy

    The platform team restores a recent backup into a non-production environment with the same PostgreSQL major version, Python runtime and worker layout as production. They run the planned stops in order and record how long each background update takes to finish, since large databases can keep working after the process restarts. The rehearsal is complete when the test homeserver starts on the target release, client logins and room messages work, and the background update queue reaches empty. Any step that needed manual intervention becomes a documented runbook item before production work begins.

  3. Confirm PostgreSQL and Python floors

    The operator compares the production PostgreSQL server version and the Python runtime against the minimums stated in the target release notes. Versions that are at or past upstream end of life need a platform upgrade planned as a separate change, with its own rollback point, rather than being bundled into the Synapse change. The check is complete when the version output for both components is saved in the change record and every floor is met or has a scheduled fix. Confirm the locale and collation settings on any new database cluster before the homeserver connects to it.

  4. Take a consistent backup and mark the rollback point

    The database administrator takes a PostgreSQL backup that is consistent with the media store and the homeserver signing keys, and records the time it was taken. The team verifies that the backup restores in a test environment before relying on it. This is the rollback point for any step that changes schema, because the upgrade notes warn that rolling back can be difficult after schema changes. The step is done when a restore test has succeeded and the backup identifier is written into the change record with the statement that restoring it is the only route back once schema changes have run.

  5. Stop writers and deploy the target release

    The operator stops the main process and every worker that writes to the database or handles client and federation traffic, so that no new events arrive during the schema change. They then deploy the target Synapse release to every process, including the workers that share the same configuration, and confirm that all of them run the same version. Schema changes applied at startup are recorded in the change log. The step is complete when every process reports the target version and the logs show a clean start with no migration errors.

  6. Watch background update progress until it finishes

    After restart, the team monitors the background update queue in the database and the Synapse logs while the homeserver serves traffic. Background updates run in batches throttled by the background_updates settings, with the default batch size and sleep interval set in the configuration manual, so their progress can be slow on large databases. The operator should not start the next release until the queue is empty and the logs show no repeated failures. Any tuning of the batch size or sleep interval is made deliberately, recorded and reversed once the queue drains. Confirm the completion state directly in the database before closing the step.

  7. Verify client and federation traffic

    The team checks that users can log in, send messages, join rooms and load history from several clients, and that federation works with at least one remote server that already shares rooms with the homeserver. They also check the federation listener and delegation endpoints from outside the network. The step closes when those checks pass, the monitoring dashboards show normal error rates, and the results are added to the change record. If checks fail, the team uses the documented rollback point and does not start further releases.

  8. Plan the next release only after sign-off

    Once the target release is stable and its background updates have completed, the operator opens a new change record for the next release in the sequence, starting again from the release notes. The owner records the time the queue emptied and the rollback point for that release. The step is done when the sign-off record shows the completed background updates, the verified traffic checks and an owner for the next upgrade. Schedule the next change only after this record is complete.

What makes background updates and upgrades take longer

This table lists the factors that lengthen a Synapse upgrade and its background database updates, with the reason each one adds work and what to check before scheduling. Read it before estimating a window, since the drivers compound: a large database on an old release with custom patches and no test copy is the slowest combination. Use the checks to decide which items need confirming with your own environment before the upgrade date is set.

DriverWhy it adds workWhat to check
Database size and room historyBackground updates rewrite or backfill rows across tables, so more stored events and state mean more batches to process before the new release is fully working.Measure database size and the largest room state tables, and check the background update progress view after a test upgrade.
Number of Synapse releases skippedEach release can add schema changes and background updates, and the upgrade notes must be read for every version crossed, not only the target.List every release between your current and target version and collect the upgrade notes for each one.
Custom configuration and local patchesCustom settings, modules or patched code may conflict with new defaults or schema changes and need retesting after each step.Inventory homeserver.yaml overrides, installed modules and any forked code, then confirm each against the target release notes.
Worker layout and RedisWorkers and the main process must run compatible versions, and Redis replication carries traffic between them during the upgrade window.Confirm all workers and the main process move to the same release, and check how Redis is configured and restarted.
PostgreSQL version and localeSynapse drops support for PostgreSQL versions that reach upstream end of life, so an older cluster may need its own upgrade first, and locale settings can cause errors on a new cluster.Check the PostgreSQL major version against the Synapse floor and the PostgreSQL support dates, and verify database locale settings on the target cluster.
Availability of a test copyWithout a restored copy of production data, background update duration and failures are only discovered in production, and rollback is hard once schema changes apply.Confirm you can restore a recent backup to separate hardware and run the full upgrade there before production.
Change control requirementsRegulated teams often need approval, a documented rollback plan and a defined maintenance window, which can lengthen the schedule before any technical work starts.Ask your change board what evidence it needs, including test results, backup verification and the process for monitoring background updates after restart.

Questions teams ask before a Synapse upgrade on a large database

Can Synapse background database updates be skipped after an upgrade?

Not safely in most cases. Background updates are the mechanism Synapse uses to finish schema and data changes that are too heavy to run during startup, and later releases can depend on them having completed. Synapse exposes settings under background_updates in the configuration manual, including batch size, batch duration and sleep interval, which control how fast the work runs. Slowing or pausing the work changes timing, not the end state. Treat the updates as part of the upgrade, plan a window that allows them to finish, and confirm with the upgrade notes for your target release whether any step needs manual action before you move to the next version.

How do we tell that background updates have finished?

Check the database itself and the server logs, then confirm the homeserver behaves normally under real traffic. The background update state is held in the Synapse database, so the team can query it and watch the count of remaining updates fall to zero over time. Logs record each update as it runs. Before you schedule the next upgrade, confirm that no updates remain queued and that the write load and replication lag look like the pre-upgrade baseline. Record the query, the baseline and the result in your change record so the next operator can repeat the check.

Is a rollback possible after Synapse changes the database schema?

Often not in a simple way. The Synapse upgrade notes warn that rolling back can be difficult because of database schema changes between releases. Your practical rollback option is usually a database backup taken before the upgrade, restored together with the matching application version, which means losing any writes made after the backup. Confirm the exact limits for each release in the upgrade notes, and test a restore of a copy of the production database before the change. Ask your team to write down the point after which rollback is no longer a supported path.

What does an outside team need from us to plan this upgrade?

An outside team needs enough access and facts to test the upgrade against your real data shape, not a generic guess. Typical inputs include the current Synapse and PostgreSQL versions, the configuration files with secrets removed, the database size and growth rate, worker layout, Redis use, backup and restore evidence, a staging environment that can hold a recent copy of the database, and the maintenance windows your business allows. You should also name a decision-maker who can accept the rollback limits and the change plan in writing before work starts.

Can our own staff run a Synapse upgrade on a large database?

Yes, if they have the skills and time to test, monitor and recover. The work requires PostgreSQL administration, familiarity with Synapse configuration, the ability to read every upgrade note between your current and target versions, and a staging copy that matches production closely enough to reveal slow background updates. Many teams keep the routine steps in house and bring in a partner for the first large-database upgrade or for a platform change, such as a PostgreSQL major version, that runs at the same time. Assess honestly who will be on call during the window.

What drives the cost of an outside upgrade engagement?

Cost follows the written scope. The main components are the assessment of current versions and notes, staging work that reproduces the database, the upgrade runbook, the change window support, the post-upgrade checks and any follow-up fixes. Costs rise with the number of releases crossed, database size, the number of workers and environments, the amount of custom configuration and the time spent on rollback testing. Recurring costs appear only if you buy a retainer for ongoing upgrades or monitoring. DeployOpen does not publish a price list, so ask for a quote that lists each component, what is included, what the client provides, and what triggers a change order.

How long will background updates take on our database?

The duration depends on the database, not on a fixed number. The main drivers are the size and write activity of the tables that each update touches, the batch size and sleep settings in background_updates, the hardware and PostgreSQL configuration, and the load from live users during the run. Larger batches and shorter sleeps finish sooner but add load, so the setting is a trade-off. Measure the run in staging with a recent copy of your data, then ask any outside team to base its schedule on that measurement and to state the assumptions in writing.

How DeployOpen scopes and delivers a Synapse upgrade

DeployOpen treats background database updates as part of the upgrade itself, not an afterthought. We plan the Synapse upgrade path, the database size and the release window together, then build, test and hand over a runbook that shows when the update queue has finished. Engagements are fixed-scope and agreed in writing before work starts.

How we scope

  • Written scope covers current Synapse version, target version and every release note between them.
  • We inventory database size, PostgreSQL version and recent background update history on your cluster.
  • Scope states which background updates must finish before the next release, and who confirms that.

How we build

  • We build a staging copy of your database and run the upgrade path with timed background update runs.
  • We tune background_updates batch size and sleep interval against your staging load, then record the settings.
  • We test restart behavior, monitoring queries and rollback limits, and document results in a findings report.

How we hand over

  • Deliverables include the upgrade runbook, tuned configuration values and monitoring checks for queue progress.
  • Your operators walk through each step on staging, with questions answered before the production window.
  • Handover documents which release each background update set belongs to, so your team can plan the next upgrade.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers for Synapse and its database.
  • A retainer can cover planning the next Synapse release, reviewing its notes and retesting background updates.
  • Ask any provider to confirm which Synapse and PostgreSQL versions their support covers before signing.

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.