Why upgrade PostgreSQL under Mattermost before support ends
If your self-hosted Mattermost database runs on a PostgreSQL major version that is nearing end of life, plan the move to a newer major version now, while you still choose the timing. The Mattermost team needs to confirm two things together: the target PostgreSQL version and the Mattermost server release that supports it. Mattermost follows the PostgreSQL community policy of 5 years of support per major version, and it drops support for a version in a later server release once that version reaches end of life. The PostgreSQL versioning policy lists version 14 as supported until November 12, 2026, so a server upgrade that raises the database floor can arrive before your database version is out of support.
Start by inventorying the PostgreSQL version your Mattermost server actually connects to, including any managed database service, read replica or standby that sits in the same environment. Then check the target Mattermost release in the server releases notes and the PostgreSQL versions it accepts, because the server floor and the database support window can move at different times. Record the current config.json database settings and the database owner, since both will be needed during the cutover. Mattermost documents two supported approaches: pg_upgrade for in-place upgrades of large databases, and pg_dump with pg_restore for moves to another machine. Choosing between them, and deciding how long Mattermost must stay stopped, is the decision that most affects the maintenance window. Confirm the backup and restore test with your own team before the window is booked.
What changes in PostgreSQL and Mattermost that affects the database move
This table compares the PostgreSQL and Mattermost dates and PostgreSQL 18 changes that bear on your database move, and each row states what to check in your own environment. Read it to decide which PostgreSQL target fits your Mattermost release path and which settings to review before you start. The main takeaway is that the PostgreSQL version floor for each target Mattermost release must be confirmed in the release notes and upgrade docs before you pick a version.
| Change | Impact on the Mattermost database | Action needed |
|---|---|---|
| PostgreSQL 14 end of support (November 12, 2026) | Databases on 14 move out of community support on this date, and Mattermost drops support for a PostgreSQL version once it reaches end of life in a later release. | Plan the move off 14 before this date and confirm which PostgreSQL versions your target Mattermost release accepts. |
| PostgreSQL 15 end of support (November 11, 2027) | 15 remains supported through the Mattermost v12.0 support window, but the Mattermost v12.0 version floor for PostgreSQL must be confirmed in its release notes. | Confirm whether 15 is your target or an interim step, and schedule the next move before this date. |
| PostgreSQL 16 and 17 end of support (November 9, 2028 and November 8, 2029) | These versions are supported longer, so they suit a database that will run across several Mattermost monthly releases and into an ESR. | Check that your chosen version stays inside the support window of your intended Mattermost release line. |
| PostgreSQL 18 end of support (November 14, 2030) | The latest listed major version has the longest support window, and its pg_upgrade changes affect how you plan the move. | Test your Mattermost workload on 18 in a staging copy before choosing it as the production target. |
| Mattermost v11.11 support end (2026-12-15) | Servers still on v11.11 stop receiving support on this date, which sets a deadline for the server side of the upgrade. | Record the date and decide whether the database move happens before or with the server upgrade. |
| Mattermost v12.0 release and support end (released 2026-10-16, support ends 2027-01-15) | v12.0 has its own PostgreSQL version floor, which may require a newer database than your current one. | Confirm the v12.0 PostgreSQL floor in the release notes and upgrade docs before you schedule the database move. |
| Mattermost v11.7 ESR support end (2027-05-15) | If you run the ESR line, the database must be on a version your ESR accepts through this date. | Confirm the PostgreSQL floor for v11.7 and any later ESR steps with Mattermost documentation. |
| PostgreSQL 18 pg_upgrade retains planner statistics | Planner statistics survive the major upgrade, which can reduce the post-upgrade slowdown caused by cold statistics. | Still run ANALYZE on critical Mattermost tables after the move and compare query timing with your baseline. |
| PostgreSQL 18 pg_upgrade parallel jobs and --swap option | Parallel jobs can shorten an in-place upgrade of a large Mattermost database, and --swap avoids copying data files. | Confirm the flags with your PostgreSQL 18 documentation, test them on a restored copy, and keep the full backup. |
| MD5 password authentication deprecated in favor of SCRAM (PostgreSQL 18) | Mattermost database connections or roles that still use MD5 may fail or need changes after the move. | Review pg_hba.conf and role password types, and move roles to SCRAM before or during the upgrade. |
pg_upgrade or pg_dump and pg_restore: which path fits your database
Use pg_upgrade when the database is large and the new PostgreSQL major version can be installed on the same machine as the current one. Mattermost documents pg_upgrade for in-place upgrades of large databases, so this is the path most single-server deployments with substantial message history will consider first. The tool converts the existing data directory to the new version's format rather than copying every row to a new server.
- Prerequisite backup: Take a full backup before anything else and confirm it can be restored, because pg_upgrade changes the data directory on the host.
- Mattermost stopped: Stop the Mattermost service before running pg_upgrade so no writes reach the database during the conversion.
- Host changes: Both the old and new PostgreSQL binaries must be installed on the host, and the new cluster is initialized alongside the old one.
- Main risk: A failed or interrupted run can leave the data directory in a state that needs the backup to recover, so rollback depends on that backup.
- Planning check: Confirm the Mattermost upgrade step and supported PostgreSQL floor for your target version on the Mattermost upgrade page before scheduling.
Confirm the exact procedure and PostgreSQL version floor against the Mattermost PostgreSQL upgrade page for your target Mattermost version before the maintenance window.
Use pg_dump with pg_restore when the database must move to a different machine or when you want a clean new cluster rather than converting the existing one. Mattermost documents this path for cross-machine moves, and it works well when the new database server is already built and tested. Restore time grows with database size, so it fits smaller databases or windows that allow a longer pause.
- Prerequisite backup: Keep the source database untouched as a fallback until the restored copy has been verified against the application.
- Mattermost stopped: Stop Mattermost before the dump so the exported data is consistent.
- Host changes: The new PostgreSQL server is provisioned separately, and the application configuration must point to it after restore.
- Main risk: Downtime extends from dump through restore and verification, and any configuration or network change to the new host adds to it.
- Source retention: The original server stays available for rollback, which adds to infrastructure you must keep running for a period.
Confirm the dump and restore sequence, and any options Mattermost recommends for your version, against the Mattermost upgrade page before choosing this path.
Consider logical replication when the goal is the shortest outage the database engine allows. PostgreSQL documents that logical replication works between different major versions and allows major upgrades with only several seconds of downtime. The new server is kept in sync with the old one while Mattermost keeps running, and the switchover is the only step that interrupts service.
- Setup effort: A publication on the old server and a subscription on the new server must be configured and monitored until they catch up.
- Mattermost check: PostgreSQL's documentation does not cover Mattermost's own requirements, so confirm with Mattermost whether this method is supported for your version before using it.
- Switchover: The application must be stopped or redirected at cutover, and writes must be fully replicated before it starts against the new server.
- Main risk: Schema differences, sequences and unreplicated objects can cause subtle data gaps if they are not checked before cutover.
- Rollback path: Plan how writes would return to the old server if the new one fails after switchover.
Before choosing this method, check the Mattermost PostgreSQL upgrade page and the upgrade procedure for your target version, and test the switchover in a non-production environment.
Backups, inventory and a test environment to prepare before the cutover
A PostgreSQL major upgrade under Mattermost is only as safe as the preparation behind it. The cards below cover what to protect, what to record, what to rehearse and who must agree before Mattermost is stopped. Each item feeds the cutover decision, so gaps found here are cheaper to close than gaps found during the maintenance window.
Full backup with a tested restore
Take a full backup of the Mattermost database before any change, and stop Mattermost first, as the Mattermost PostgreSQL upgrade docs require. A backup that has never been restored is only a hope, so restore it to a separate host and confirm that Mattermost starts against it and that recent messages and file references are present. Record the backup time, checksum and storage location in the change record. Also back up the Mattermost file storage, since a database backup alone does not restore attachments.
Mattermost upgrade docsCurrent PostgreSQL inventory
Record the exact PostgreSQL version, installed extensions, tablespaces and the server settings that affect the upgrade. Check the pg_hba.conf authentication methods in use, since PostgreSQL 18 deprecates MD5 password authentication in favor of SCRAM, and any role still using MD5 must be migrated before the target version is adopted. Note whether PgBouncer or another pooler sits between Mattermost and the database, along with its pool mode and connection limits, because both the upgrade method and the cutover steps change when a pooler is involved.
Authentication methodsTest environment from recent production data
Build a non-production environment from a recent copy of the production database, running the same Mattermost server version, the target PostgreSQL version and the same operating system family. Run the full upgrade sequence there first and time each step, so the maintenance window is planned from measured data rather than estimates. Use the test run to confirm that logins, search, file downloads and scheduled jobs behave as expected. Handle the copied data under the same access rules as production, because it contains real messages.
Matching Mattermost server and plugins
Confirm that the Mattermost server version in place can run against the target PostgreSQL major version, and check the Mattermost release notes for any database floor that applies to the server version you plan to adopt. List every installed plugin with its version, source and whether it was built by your team, then confirm each one supports the planned server release. Plugins that were built for an older server or framework can fail after the upgrade, so plan rebuilds or replacements before the cutover date.
Server releasesReplicas and their upgrade order
Determine whether the deployment has read replicas, a high availability cluster or both, because each changes the order of operations. Read replicas and the primary database must be on compatible PostgreSQL versions for the chosen method, and a high availability cluster has several application nodes that must be stopped and restarted in a controlled sequence. Document which node or replica is upgraded first, how traffic is drained, and how the team fails back if the new primary does not come up cleanly. Confirm the replica setup with the database owner before the window opens.
Access, window and sign-off from your side
The client must provide administrative access to the Mattermost host, the database server, the backup storage and any load balancer, along with a maintenance window agreed with users. The data owner should sign off on the backup and restore evidence, the test results and the rollback criteria before production work begins. DeployOpen prepares the inventory, the test environment, the runbook and the restore test plan, while your team approves the change and owns the production systems. Confirm these responsibilities in writing before work starts.
Which check comes first, and where the choice of method fits
The diagram starts with the current PostgreSQL version checked against its support dates, then the target Mattermost release and its PostgreSQL floor. The method choice (pg_upgrade or dump and restore) depends on database size and host layout. Every path passes through a full backup, a test restore and a rehearsal in a test environment before Mattermost is stopped on production. A high availability branch sequences the replicas and the primary, and the last decision is go-live or rollback. Treat it as a planning view, not a runbook.
Planning view of the decision path from version checks to go-live or rollback.
The upgrade sequence with checks and rollback points
This sequence moves a Mattermost database to a newer PostgreSQL major version while keeping a verified way back at every destructive step. Each step ends with a check that tells the team whether it can safely continue.
Confirm target Mattermost and PostgreSQL versions
Confirm the Mattermost server version you will run after the upgrade and the PostgreSQL major version it requires. Check the Mattermost server releases page for the support end dates of your current and target releases, and confirm the PostgreSQL version floor for that Mattermost release in the Mattermost PostgreSQL upgrade documentation. Also confirm the PostgreSQL support end date for your current major version from the PostgreSQL versioning policy. The step is done when the team has written down the current Mattermost version, the current PostgreSQL version, the target PostgreSQL version and the planned Mattermost version, and the owner has signed off on that pairing.
Take and verify a full backup
Take a full backup of the Mattermost database and the file storage, and record the Mattermost configuration file and plugin list alongside it. Verify the backup by restoring it to a scratch PostgreSQL instance and confirming that the Mattermost schema and sample data load correctly. This is the first rollback point: nothing destructive has happened yet, so the team can return to the current state from here. The step is done when the restore test succeeds and the backup location, checksum and restore steps are documented for the on-call engineer.
Stop Mattermost and confirm no writes
Stop the Mattermost service on every application server that connects to the database, so that no new writes arrive during the copy. Confirm the process has exited on each node and that no background jobs or scheduled tasks are still writing to PostgreSQL. If Mattermost runs behind a load balancer or proxy, remove the node from rotation first so users see a planned maintenance page instead of errors. The step is done when the team confirms zero active Mattermost connections in PostgreSQL and a fresh backup has been taken from this quiet state.
Run the chosen upgrade method on a copy
Run the method you selected against a copy of the database, not the production cluster. Use pg_upgrade for in-place upgrades of large databases, or pg_dump with pg_restore for a move to another machine, as described in the Mattermost PostgreSQL upgrade documentation. Keep the source cluster untouched and record the exact commands, versions, options and elapsed time. Check the command output for errors and confirm the new cluster starts. The step is done when the new cluster accepts connections and the team has a written runbook with every command used.
Test the upgraded database with a test instance
Start a test Mattermost instance pointed at the upgraded copy and check the server logs for schema or migration errors. Sign in with a test account, open a channel, upload and download a file, and run a search to confirm that the file storage paths and search index still work. Repeat the checks with the Mattermost version planned for production. The step is done when the logs are clean, login, file access and search all behave as expected, and the results are recorded against the test plan.
Schedule the production cutover with a rollback point
Agree a maintenance window with the business owners and communicate the stop time, the expected interruption and the rollback trigger. Before the window opens, take a final backup of production and mark it as the rollback point for this cutover. Assign one person to make the go or no-go decision and name the conditions that cause a rollback, such as errors in the test checks or failed restores. The step is done when the change record lists the rollback point, the decision owner and the tested restore path that the team will use if needed.
Repeat the upgrade on production and start Mattermost
Stop Mattermost again if it was restarted, then run the same upgrade method, with the same commands and options, against the production database. Keep the original data directory or cluster intact until the upgraded database is confirmed. Start Mattermost on one node first, check its logs, then start the remaining nodes. Run health checks on the Mattermost system console or health endpoints, and confirm login, file access and search from a user account. The step is done when every node is serving traffic, the health checks pass and the change record shows the verified results.
Retain the old data until the new version is confirmed
Keep the original PostgreSQL data directory or the pre-upgrade backup for as long as the team needs a route back, and do not delete it at cutover. Monitor logs, error rates and user reports through the agreed observation period, and document when the team considers the upgrade confirmed. Application-level recovery, such as downgrading the Mattermost schema, is covered by the sibling downgrade and rollback page, so refer to that guidance if the Mattermost server itself must be reverted. The step is done when the owner signs off the upgrade in writing and the retained copy is archived or removed under the retention policy.
How to check the version floor Mattermost enforces before you upgrade
Mattermost sets a minimum PostgreSQL version for each server release, and the floor can move between releases. Before you pick a target Mattermost version, read the PostgreSQL requirement in that release's upgrade documentation and compare it with the version your database runs today. The floor is a property of the target release, not of your current installation, so a database that is acceptable for your present server may not be acceptable for the one you are moving to. Mattermost also follows the PostgreSQL community support window and drops a PostgreSQL version once it reaches end of life, so a floor can rise even when your server version does not change. Confirm the floor for each target release against the Mattermost PostgreSQL upgrade documentation and your own test environment, not against this page or a previous release's notes.
Once you know the floor, decide the order of work. If your database is below the target floor, upgrade PostgreSQL first while still running the current Mattermost release, confirm that the current server runs cleanly on the newer database, and only then move the application. If the database already meets the floor, upgrade Mattermost first and leave PostgreSQL for a separate window. Either way, the server or the upgrade process can refuse to proceed when the floor is not met, so treat a failed version check as a stop condition rather than a warning to override. Run the check in a staging copy of production data, record the PostgreSQL version reported by the server and by the database itself, and keep that record with your change ticket.
Write the sequencing decision down before the maintenance window opens. Name the target Mattermost release, the floor it documents, the PostgreSQL version you will run afterward, and the rollback point if the first step fails. If the floor forces a PostgreSQL move that your chosen method cannot complete within the window, the upgrade may need to be split across two windows, and that split should be agreed with the business owners in advance. Ask your Mattermost or PostgreSQL provider to confirm in writing which PostgreSQL versions the target release supports, and check whether any plugins or integrations you run have their own database requirements.
What makes a PostgreSQL upgrade under Mattermost take longer
This table lists the factors that stretch a Mattermost PostgreSQL major upgrade and what each one changes in the plan. Read each row as a question to answer about your own environment before you choose between pg_upgrade and dump and restore. The main takeaway is that database size is only one driver, and hosts, replicas, poolers and validation scope often add more work than the data itself.
| Driver | Why it matters | How to reduce it |
|---|---|---|
| Database size | Larger databases make a dump and restore take longer, which is why Mattermost documents pg_upgrade for in-place upgrades of large databases. | Measure the database on a copy first, then choose pg_upgrade in place if a restore would not fit the window. |
| Hosts and cross-machine moves | Moving to a new server means the dump must be transferred and restored across machines, adding copy and verification time. | Keep the upgrade on the same host where the storage allows it, and test transfer speed on your network before the window. |
| High availability and read replicas | Database read replicas and search replicas must be rebuilt or reordered after the primary changes version, so each one adds work. | Write down the replica order and rebuild steps in advance, and confirm with your architecture plan which replicas are in scope. |
| Custom extensions and database objects | Extensions, custom functions or objects may not exist or behave the same on the new major version, and each must be checked. | Inventory extensions and custom objects before the window and confirm each one installs on the target version. |
| Authentication changes | Moving off MD5 password authentication toward SCRAM changes how clients connect, so application and pooler credentials need updating. | Review the authentication settings and test logins with the new version before the production change. |
| Connection poolers | Poolers such as PgBouncer hold connections and settings that must match the new server, and misconfiguration blocks Mattermost from starting. | Record pooler settings, point them at the new server in a test run, and confirm pool modes and limits. |
| Backup and restore time | A full backup is required before Mattermost is stopped, and restore testing adds time that is easy to underestimate. | Time a test restore of the backup, and keep a verified copy that can be restored quickly if the upgrade fails. |
| Number of environments to validate | Each environment such as staging, test and production needs its own dry run, and differences between them often cause surprises. | Use one runbook across environments, and record what differed between each dry run. |
| Maintenance window | The window the business allows sets how much downtime is acceptable and which method fits, since dump and restore usually needs more time than pg_upgrade. | Ask stakeholders for the window early, and confirm with your own tests whether the planned method fits inside it. |
Questions teams ask before upgrading PostgreSQL under Mattermost
What does a PostgreSQL upgrade under Mattermost cost, and what is one-time versus recurring?
The cost is mostly staff time and test infrastructure, and most of it is one-time. Your team or a partner spends time on the backup, the method choice, a rehearsal on a copy of the database, the production cutover and verification. Test capacity is a one-time cost for a second environment sized like production. Recurring costs come from later work: the PostgreSQL minor releases, which the PostgreSQL versioning policy says arrive at least every three months, and the next major upgrade when your version nears end of life. If you hire outside help, the quote should separate fixed-scope upgrade work from any retainer for ongoing support. Ask each vendor to list who does what, which environments they test in, and what is excluded. Mattermost does not publish prices for its own services, so ask the Mattermost sales team directly if you also need a commercial plan change.
How long does a PostgreSQL major upgrade take for Mattermost?
Duration depends on database size, the method you choose, how many Mattermost nodes you run, and how many rehearsals your change process requires. Database size drives backup, dump or upgrade time. Method drives downtime: Mattermost documents pg_upgrade for large in-place upgrades and pg_dump with pg_restore for cross-machine moves, and PostgreSQL notes that logical replication can cut major-upgrade downtime to several seconds. Other drivers include extensions, custom indexes, the number of rehearsals, and whether your change board needs a formal window. Ask for a timeline built from a rehearsal on a copy of your data, not from a generic estimate. The Mattermost PostgreSQL upgrade documentation is the first thing to read to see which steps apply to your install.
What does the upgrade need from our team?
The work needs access, a recent full backup, a test copy of the database, a maintenance window, and a named approver. Mattermost must be stopped before the upgrade, so the window has to cover the stop, the upgrade, the restart and verification. Access includes the database host, the Mattermost server configuration, and the file storage that holds attachments. A test copy should match production in PostgreSQL version, data volume and installed extensions. The approver signs off on the rehearsal results and the go-live decision. Confirm with your Mattermost administrators which deployment type you run, because a single server and a high availability cluster change the stop and restart steps.
Can our own team upgrade PostgreSQL under Mattermost without a partner?
Yes, a capable team can do it with the Mattermost and PostgreSQL documentation, a test environment and a restore they have proven. The required knowledge covers PostgreSQL administration, Linux service management, backup and restore, and Mattermost configuration. The risk lies in skipping the rehearsal or never testing the restore. Before you start, confirm that your current Mattermost release supports the target PostgreSQL version, since the Mattermost server release notes set version floors. Ask whether anyone on your team has done a pg_upgrade or a dump and restore on a production-sized copy. If not, a partner can run the rehearsal with you, which is a scoped engagement that DeployOpen plans and documents in writing before work starts.
Should we use pg_upgrade or pg_dump and pg_restore?
Choose pg_upgrade for a large in-place upgrade on the same machine, and choose pg_dump with pg_restore when you move the database to another machine. Mattermost documents both paths and requires a full backup with Mattermost stopped first. pg_upgrade avoids a full export and reload, and PostgreSQL 18 retains planner statistics across major upgrades and adds parallel jobs. pg_dump and pg_restore give you a logical copy that is easier to move and inspect, but restore time grows with data volume. Logical replication is a third option for very low downtime, though it adds setup work. Confirm the choice against your database size, your maintenance window and whether the target host is new. The Mattermost upgrade guide for PostgreSQL is the next read.
What happens if the PostgreSQL upgrade fails?
If the upgrade fails, you restore from the full backup you took before stopping Mattermost, then bring Mattermost back on the previous database. This is why the backup must be verified by a real restore before the change window. Failure modes include a failed pg_upgrade check, a restore that stops on an error, or Mattermost starting against a database that fails its schema checks. Plan the rollback decision point in advance: state the time after which you will restore rather than continue, and who makes that call. Keep the old PostgreSQL binaries and data directory until you have verified the new cluster, if your method allows it. Confirm with your database administrators that point-in-time recovery is configured, because it can narrow data loss between the backup and the failure.
How DeployOpen scopes and delivers a Mattermost PostgreSQL upgrade
DeployOpen approaches a Mattermost PostgreSQL upgrade as a written, fixed-scope change inside your own infrastructure. We confirm the current and target database versions, the upgrade method and the rollback path before any production work starts, so your security and operations teams can review each step.
How we scope
- Confirm your current PostgreSQL major version and the Mattermost server version it runs under.
- Agree the method in writing: pg_upgrade in place or pg_dump with pg_restore, based on database size and host layout.
- Record the planned Mattermost stop, backup point and maintenance window with your operations owner.
How we build
- Rehearse the upgrade on a copy of your database in a non-production environment you control.
- Verify the Mattermost server can connect to the target PostgreSQL version and that schema migrations complete.
- Test sign-in, file access, search and integrations against the upgraded database before cutover.
How we hand over
- Deliver a runbook with backup, stop, upgrade, start and verification steps for your own team to repeat.
- Document the rollback procedure, including the backup restore path and the conditions that trigger it.
- Provide a record of versions, dates, checks and open items, so your compliance and security reviewers can trace the change.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the engagement closes.
- Plan the next PostgreSQL and Mattermost upgrade windows with you as supported versions approach end of life.
- Confirm with your vendors and your own environment any version floors or extensions that apply before each change.

