> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrades

> How PostgreSQL version upgrades work in ClickHouse Managed Postgres

export const ScalePlanFeatureBadge = ({feature = 'This feature', linking_verb_are = false}) => {
  return <div className="scalePlanFeatureContainer">
            <div className="scalePlanFeatureBadge">
                Scale plan feature
            </div>
            <div>
                <p>{feature} {linking_verb_are ? 'are' : 'is'} available in the Scale and Enterprise plans. To upgrade, visit the plans page in the cloud console.</p>
            </div>
        </div>;
};

export const EnterprisePlanFeatureBadge = ({feature = 'This feature', support = false, linking_verb_are = false}) => {
  return <div className="enterprisePlanFeatureContainer">
            <div className="enterprisePlanFeatureBadge">
                Enterprise plan feature
            </div>
            <div>
                <p>{feature} {linking_verb_are ? 'are' : 'is'} available in the Enterprise plan. {support ? `Contact support to enable this feature.` : 'To upgrade, visit the plans page in the cloud console.'}</p>
            </div>
        </div>;
};

export const BetaBadge = ({link, galaxyTrack, galaxyEvent}) => {
  if (link) {
    return <a href={link} target="_blank" rel="noopener noreferrer" className="betaBadge" onClick={galaxyTrack && galaxyEvent ? galaxyOnClick(galaxyEvent) : undefined}>
                <span>Beta</span>
            </a>;
  }
  return <a href="https://clickhouse.com/docs/reference/settings/beta-and-experimental-features#beta-features" className="betaBadge">
            <span>Beta feature</span>
        </a>;
};

<BetaBadge link="https://clickhouse.com/cloud/postgres" galaxyTrack={true} galaxyEvent="docs.managed-postgres.upgrades-beta" />

ClickHouse Managed Postgres handles PostgreSQL version upgrades to keep your instances secure and up to date. Both minor and major version upgrades are supported with minimal disruption.

<h2 id="maintenance-updates">
  Maintenance updates
</h2>

Regular maintenance in the PostgreSQL instances includes the following:

* Minor version upgrades (e.g., 17.4 to 17.5) include bug fixes and PostgreSQL engine security patches.
* Managed Service features. Improvements to native CDC, observability, pg\_clickhouse, and other extensions.
* Operating system and system components patches. Including security fixes, efficiency, and other improvements.

These are performed via failover and typically result in only a brief disconnect, often lasting just a few seconds.

For instances with [standbys](/products/managed-postgres/high-availability) enabled, the upgrade is applied to the standby first, followed by a failover to minimize downtime.

<h2 id="scheduled-upgrades">
  Scheduled upgrades
</h2>

<ScalePlanFeatureBadge feature="Scheduled upgrades" linking_verb_are="true" />

By default, maintenance is applied to your instance whenever a new release is ready.
With **scheduled upgrades** you choose a two-hour UTC window during which that
maintenance may be applied, so the brief failover lands at the time that's least
disruptive to your workload. Expected downtime is less than 1 minute within the window.

On the Enterprise plan you can also restrict upgrades to specific
[days of the week](#days-of-the-week). On the Scale plan you choose the time period only,
and upgrades may be applied on any day within it.

<h3 id="configure-a-schedule">
  Configure a schedule
</h3>

<Steps>
  <Step title="Open the instance settings" id="open-settings">
    Select your instance, then select **Settings** from the left menu and scroll to the
    **Configuration** section.
  </Step>

  <Step title="Open the scheduled upgrades flyout" id="open-flyout">
    In the **Scheduled upgrades** subsection, select **Configure schedule**. If a schedule
    is already set, the current schedule is shown and the button reads **Edit schedule**.
  </Step>

  <Step title="Pick a time period" id="pick-time-period">
    Select one of the twelve two-hour UTC windows from the **Time period (UTC)** list. A time
    period is required.
  </Step>

  <Step title="Optionally restrict the days" id="pick-days">
    On the Enterprise plan, select one or more days under **Day(s) of the week**. Leave every
    day unselected to allow upgrades on any day within the time period.
  </Step>

  <Step title="Save" id="save">
    Select **Save**. The schedule takes effect immediately and is shown in the
    **Scheduled upgrades** subsection, for example
    `Scheduled upgrades: Sat, Sun at 12:00 a.m. - 2:00 a.m. UTC`.
  </Step>
</Steps>

You need the `control-plane:postgres-service:manage` permission on the instance to change
its schedule. The controls are also disabled while an instance is stopped or is still
being provisioned.

<h3 id="time-periods">
  Time periods
</h3>

Windows are two hours long and are always expressed in UTC — there's no local-timezone
selection. The available windows are:

| First half of the day (UTC) | Second half of the day (UTC) |
| --------------------------- | ---------------------------- |
| 12:00 a.m. - 2:00 a.m.      | 12:00 p.m. - 2:00 p.m.       |
| 2:00 a.m. - 4:00 a.m.       | 2:00 p.m. - 4:00 p.m.        |
| 4:00 a.m. - 6:00 a.m.       | 4:00 p.m. - 6:00 p.m.        |
| 6:00 a.m. - 8:00 a.m.       | 6:00 p.m. - 8:00 p.m.        |
| 8:00 a.m. - 10:00 a.m.      | 8:00 p.m. - 10:00 p.m.       |
| 10:00 a.m. - 12:00 p.m.     | 10:00 p.m. - 12:00 a.m.      |

Custom start times, custom window lengths, and more than one window per instance aren't
supported.

<h3 id="days-of-the-week">
  Days of the week
</h3>

<EnterprisePlanFeatureBadge feature="Restricting upgrades to specific days of the week" />

Restricting the days is optional:

* **No days selected** — upgrades may be applied on any day, inside the chosen time period.
* **One or more days selected** — upgrades are only applied on those days, inside the
  chosen time period. Selecting all seven days is equivalent to selecting none.

<h3 id="schedule-scope">
  What a schedule applies to
</h3>

A schedule governs **platform maintenance** only — the minor version upgrades, managed
service feature updates, and operating system patches described in
[Maintenance updates](#maintenance-updates).

Changes that you initiate yourself aren't deferred to the window and are applied as soon
as you make them. This includes [scaling](/products/managed-postgres/scaling) an instance,
resizing storage, and changing [configuration parameters](/products/managed-postgres/settings).

<Note>
  Scheduled upgrades are best effort. Maintenance may be applied outside your window when it's
  required for the health of your instance — for example when disk usage reaches 95% — or for
  critical security patches and vulnerability fixes. You'll be notified of such exceptions as
  necessary.
</Note>

<h3 id="read-replicas">
  Read replicas
</h3>

[Read replicas](/products/managed-postgres/read-replicas) follow the schedule of their
primary instance and don't have a schedule of their own, so the **Scheduled upgrades**
section isn't shown for them.

<h2 id="major-version-upgrades">
  Major version upgrades
</h2>

Major version upgrades (e.g., 17.x to 18.x) via UI and API are coming soon.
In the meantime, contact [support](https://clickhouse.com/support/program) to upgrade your ClickHouse Managed Postgres instance.
