Skip to content

Apply Maintenance Updates

Managed PostgreSQL receives platform updates, such as operating system patches and PostgreSQL minor versions, during a weekly maintenance window set per service. This page shows the PostgreSQL commands to read the window and the pending updates, move the window, and start pending updates before the window.

How maintenance works for every DBaaS engine, including how nodes are replaced, is described on Manage maintenance windows.

Important

Major version upgrades are not maintenance updates and never run in the window. You start them yourself, see Upgrade to a new PostgreSQL major version.

Read the Window and the Pending Updates

The service overview shows the window:

exo dbaas show SERVICE_NAME -z ZONE

Parameters:

  • SERVICE_NAME: name of the service, for example my-postgresql.
  • ZONE: zone of the service, for example ch-gva-2.

The Maintenance row shows the day and the start time in UTC, for example sunday (03:00:00). A new service gets a window chosen by the platform.

The API also returns the updates waiting to be installed:

exo api get-dbaas-service-pg SERVICE_NAME -z ZONE -q 'maintenance'
{
  "dow": "sunday",
  "time": "03:00:00",
  "updates": []
}

An empty updates array means nothing is pending. Each pending update has, according to the API schema, a description, a deadline (the date by which it must be installed), a start-after (the earliest time it is applied automatically) and a start-at (the time it is applied automatically).

Change the Window

exo dbaas update SERVICE_NAME -z ZONE -f \
  --maintenance-dow DAY \
  --maintenance-time TIME

Parameters:

  • SERVICE_NAME: name of the service, for example my-postgresql.
  • ZONE: zone of the service, for example ch-gva-2.
  • DAY: day of the week, monday to sunday.
  • TIME: start time in UTC, exactly HH:MM:SS, for example 03:00:00.

Pass both flags together. With only one, the command fails with both --maintenance-dow and --maintenance-time must be specified. A time such as 3:00 is rejected: the value must be eight characters long.

The CLI help lists never as a value for --maintenance-dow, but the API refuses it with 'never' maintenance option is currently not supported, only specific days of the week. Every service keeps a weekly window.

Tip

The time you set is when maintenance may start, not a slot with a guaranteed end. Put it at the beginning of your quiet period.

The window is a property of the service: a fork does not inherit it from its source. Set it on each service you create, with the same flags on exo dbaas create.

Apply Pending Updates Now

There is no exo dbaas command for this. Use the API operation:

exo api start-dbaas-pg-maintenance SERVICE_NAME -z ZONE

Parameters:

  • SERVICE_NAME: name of the service, for example my-postgresql.
  • ZONE: zone of the service, for example ch-gva-2.

The operation starts the pending updates immediately instead of waiting for the window. Read maintenance.updates first so you know what it will install.

Starting maintenance yourself is also how you test an update before production receives it: start it on a staging service, verify the application, then start it on production or let the production window apply it.

Prepare the Application

Maintenance can replace the nodes of the service. The hostname and port do not change, but the IP address behind the hostname does, and the sessions open on a replaced node end. The same happens during a plan change.

  • Connect by hostname. An IP address pinned in an application or in a firewall rule stops working after the next node replacement.
  • Make the application open a new connection when one dies.

Related Pages

Last updated on