> For the complete documentation index, see [llms.txt](https://academy.cegedim.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.cegedim.cloud/databases/postgresql/postgresql-upgrade.md).

# PostgreSQL - Upgrade

## **PaaS upgrade workflow** <a href="#postgresqlupgradeinplace-postgresqlpaasupgrade" id="postgresqlupgradeinplace-postgresqlpaasupgrade"></a>

### Request <a href="#postgresqlupgradeinplace-request" id="postgresqlupgradeinplace-request"></a>

The upgrade of a PostgreSQL PaaS is the responsibility of **cegedim.cloud** and can be requested via a [request ticket](https://itcare.cegedim.cloud/support?createTicket=true\&requestTypeIndex=3\&formName=DB_POSTGRES\&step=Request) submitted from ITCare, specifying a time slot for the operation.

{% hint style="info" %}
Please specify if the operation is to be carried out outside of business hours in order to plan an RFC.
{% endhint %}

{% hint style="success" %}
It is recommended that you upgrade your non-production environments first in order to estimate the downtime generated by the operation and to test your applications using the new engine version.
{% endhint %}

### Process <a href="#postgresqlupgradeinplace-process" id="postgresqlupgradeinplace-process"></a>

The upgrade of a PostgreSQL deployment (standalone or high availability) takes place in two fully automated steps:

* Upgrade the Operating system first if required
  * Multiple upgrades depending on the scenario: Debian 10 → Debian 11 → Debian 12 → Debian 13
* Upgrade of the PostgreSQL engine in the target version

Depending on the source and target versions of PostgreSQL, it may be necessary to first migrate the operating system to a version supported by **cegedim.cloud** (for more information, check [#postgresqlupgradeinplace-os-postgresqlsupportmatrixmatrice](#postgresqlupgradeinplace-os-postgresqlsupportmatrixmatrice "mention")).

```mermaid
graph TD
    start["🐘 PostgreSQL X<br/>Debian X"] --> deb["Upgrade Debian<br/>(Once, twice or not required)"]
    deb --> pg["Upgrade PostgreSQL X to Y *"]
    pg --> done["🐘 PostgreSQL Y<br/>Debian Y"]

    deb -.->|Handled by cegedim.cloud| pg

    note["* switch to PITR backup mode<br/>if Y is >= 12"]

    style start fill:#e8e8e8,stroke:#000,stroke-width:2px,color:#000
    style deb fill:#e8820c,stroke:#a85a00,stroke-width:2px,color:#000
    style pg fill:#1abc9c,stroke:#0e6655,stroke-width:2px,color:#000
    style done fill:#e8e8e8,stroke:#000,stroke-width:2px,color:#000
    style note fill:#1abc9c,stroke:#0e6655,stroke-width:1px,color:#000
```

### Impacts

* The duration of an upgrade is variable depending on:
  * The configured cpu and ram resources
  * The amount of data whose headers must be modified by the PostgreSQL engine.
  * The amount of data to be reindexed following a change of C library, after an OS upgrade.
  * The amount of data on which to activate the checksum (data page checksum has been activated since PostgreSQL PaaS 12)
  * The amount of data to be vacuumed.
  * The amount of data to be backed up (a full backup is performed after migration process).
* The backup mode:
  * Point-in-time Recovery (PITR) from PostgreSQL 12 and higher.
    * The "dump" backup mode disappears in favour of the "PITR" and is only used in versions of PostgreSQL lower than version 12.

### Time references <a href="#postgresqlupgradeinplace-timereferences" id="postgresqlupgradeinplace-timereferences"></a>

As an average guideline, durations for each step of an in-place upgrade of a 100 GB [pgbench](https://www.postgresql.org/docs/current/pgbench.html) database, with a single Debian upgrade:

| Step                                                                                                        | Average duration |
| ----------------------------------------------------------------------------------------------------------- | ---------------- |
| Debian upgrade (per operating system upgrade)                                                               | 10 minutes       |
| PostgreSQL reindexing                                                                                       | 5 minutes        |
| PostgreSQL upgrading                                                                                        | 1 minute         |
| PostgreSQL checksum                                                                                         | 3 minutes        |
| PostgreSQL vacuuming                                                                                        | 1 minute         |
| PostgreSQL full backup (PITR mode)                                                                          | 16 minutes       |
| **Total, standalone instance**                                                                              | **36 minutes**   |
| PostgreSQL synchronizing (high availability only: the replica is upgraded and synchronized with the leader) | 4 minutes        |
| **Total, high availability**                                                                                | **40 minutes**   |

Each additional operating system upgrade (see the supported upgrade paths below) adds about 10 minutes.

## **OS / PostgreSQL support matrix** <a href="#postgresqlupgradeinplace-os-postgresqlsupportmatrixmatrice" id="postgresqlupgradeinplace-os-postgresqlsupportmatrixmatrice"></a>

Linux distributions supported by **cegedim.cloud** depending on the PostgreSQL version:

<table><thead><tr><th width="223">PostgreSQL version</th><th>Debian distribution</th></tr></thead><tbody><tr><td>PostgreSQL 12</td><td>Debian 10</td></tr><tr><td>PostgreSQL 13</td><td>Debian 11</td></tr><tr><td>PostgreSQL 14</td><td>Debian 11</td></tr><tr><td>PostgreSQL 15</td><td>Debian 11</td></tr><tr><td>PostgreSQL 16</td><td>Debian 12</td></tr><tr><td>PostgreSQL 17</td><td>Debian 13</td></tr><tr><td>PostgreSQL 18</td><td>Debian 13</td></tr></tbody></table>

## **Supported PostgreSQL upgrade paths** <a href="#postgresqlupgradeinplace-supportedpostgresqlupdatepaths" id="postgresqlupgradeinplace-supportedpostgresqlupdatepaths"></a>

If the operating system is upgraded, it may require a complete reindexing (also handled by **cegedim.cloud**) due to changes in the C library when the operating system is upgraded.

Depending on the amount of data, this operation may take some time.

Below are the upgrade paths supported by **cegedim.cloud**:

<table data-full-width="true"><thead><tr><th width="181">Version Source</th><th>PostgreSQL 13</th><th>PostgreSQL 14</th><th>PostgreSQL 15</th><th>PostgreSQL 16</th><th>PostgreSQL 17</th><th>PostgreSQL 18</th></tr></thead><tbody><tr><td>PostgreSQL 12</td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 10 → Debian 11</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 10 → Debian 11</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 10 → Debian 11</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 10 → Debian 12</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>***</strong></p><p>Debian 10 → Debian 13</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>***</strong></p><p>Debian 10 → Debian 13</p></td></tr><tr><td>PostgreSQL 13</td><td></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 11 → Debian 12</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td></tr><tr><td>PostgreSQL 14</td><td></td><td></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 11 → Debian 12</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td></tr><tr><td>PostgreSQL 15</td><td></td><td></td><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 11 → Debian 12</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>**</strong></p><p>Debian 11 → Debian 13</p></td></tr><tr><td>PostgreSQL 16</td><td></td><td></td><td></td><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 12 → Debian 13</p></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span><strong>*</strong></p><p>Debian 12 → Debian 13</p></td></tr><tr><td>PostgreSQL 17</td><td></td><td></td><td></td><td></td><td></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr></tbody></table>

**\*** An operating system upgrade is required

**\*\*** Two operating system upgrades are required

**\*\***\* Three operating system upgrades are required


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.cegedim.cloud/databases/postgresql/postgresql-upgrade.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
