Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI Studio
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Service page
Yandex Managed Service for PostgreSQL
Documentation
Yandex Managed Service for PostgreSQL
  • Getting started
    • All guides
      • Getting information on existing clusters
      • Creating a cluster
      • Updating cluster settings
      • Stopping and starting a cluster
      • Managing PostgreSQL hosts
      • Migrating hosts to a different availability zone
      • Managing replication slots
      • Managing backups
      • Managing backup policies
      • Managing disk space
      • Maintenance
      • Updating the PostgreSQL version
      • Deleting a cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Set up alerts in Yandex Monitoring
  • Manually get the cluster out of the read-only mode
  • Changing the disk type and increasing the storage size
  • Setting up automatic increase of storage size
  1. Step-by-step guides
  2. Clusters
  3. Managing disk space

Managing disk space

Written by
Yandex Cloud
Updated at August 20, 2025
  • Set up alerts in Yandex Monitoring
  • Manually get the cluster out of the read-only mode
  • Changing the disk type and increasing the storage size
  • Setting up automatic increase of storage size

When the storage is more than 97% full, the host automatically switches to read-only mode.
To avoid issues with writing to the database, use one of the following methods:

  • Set up alerts in Yandex Monitoring to monitor storage utilization.

  • Manually get the cluster out of the read-only mode and free up the storage space by deleting some data.

  • Increase the storage size to automatically disable the read-only mode. You can also change the disk type.

  • Set up automatic storage size increase.

Set up alerts in Yandex MonitoringSet up alerts in Yandex Monitoring

  1. Navigate to the folder dashboard and select Monitoring.

  2. Select Managed Service for PostgreSQL.

  3. Create a notification channel.

  4. Create an alert with the following properties:

    1. Metrics: Set the following metric parameters:

      • Cloud

      • Folder

      • Managed Service for PostgreSQL service

      • Managed Service for PostgreSQL cluster ID

        You can get the cluster ID with the list of clusters in the folder.

      • disk.free_bytes label

    2. Alert condition: Set the Less than or equals condition for free disk space utilization percentage to trigger the alert:

      • Aggregation function: Minimum (minimum metric value for the period).
      • Warning: 90 (90% of the storage size).
      • Alarm: 95 (95% of the storage size).
      • Evaluation window: Preferred metric update period.
    3. Add the previously created notification channel.

Manually get the cluster out of the read-only modeManually get the cluster out of the read-only mode

Alert

Do not allow free disk space to drop to zero during the following actions. Otherwise, since the fail-safe mechanism is disabled, PostgreSQL will crash and the cluster will stop operating.

To disable the read-only mode:

  1. Connect to the database using any method of your choice.

  2. Open a transaction and run the following command inside it:

    SET LOCAL transaction_read_only TO off;
    
  3. As part of the same transaction, delete the data you do not need using the DROP or TRUNCATE operators. Do not use the DELETE operator, as it marks rows as deleted but does not physically delete them from the database.

  4. Commit the transaction and restart all connections to the database.

For example, if your database contains a table called ExcessDataTable1 that you no longer need, delete it using the following transaction:

BEGIN;
SET LOCAL transaction_read_only TO off;
DROP TABLE ExcessDataTable1;
COMMIT;

Changing the disk type and increasing the storage sizeChanging the disk type and increasing the storage size

Note

Some PostgreSQL settings depend on the storage size.

Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas page and check the HDD storage capacity and SSD storage capacity lines under Managed Databases to make sure there is available quota for storage space.

Warning

  • You cannot decrease the storage size.
  • While resizing the storage, cluster hosts will be unavailable.
Management console
CLI
Terraform
REST API
gRPC API

To change the disk type and increase the storage size for a cluster:

  1. Navigate to the folder dashboard and select Managed Service for PostgreSQL.

  2. Select a cluster and click Edit in the top panel.

  3. Under Storage size:

    • Select the disk type.
    • Specify the required disk size.
  4. Click Save changes.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To change the disk type and increase the storage size for a cluster:

  1. View the description of the CLI command to update the cluster:

    yc managed-postgresql cluster update --help
    
  2. Specify the disk type and required storage size in the cluster update command (at least as large as disk_size in the cluster properties):

    yc managed-postgresql cluster update <cluster_name_or_ID> \
        --disk-type <disk_type> \
        --disk-size <storage_size_in_GB>
    

To change the disk type and increase the storage size for a cluster:

  1. Open the current Terraform configuration file that defines your infrastructure.

    For more information about creating this file, see Creating clusters.

    For a complete list of available Managed Service for PostgreSQL cluster configuration fields, see the Terraform provider documentation.

  2. In the Managed Service for PostgreSQL cluster description, change the disk_type_id and disk_size attributes in the config.resources block:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      config {
        resources {
          disk_type_id = "<disk_type>"
          disk_size    = <storage_size_in_GB>
          ...
        }
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    Time limits

    A Terraform provider sets the timeout for Managed Service for PostgreSQL cluster operations:

    • Creating a cluster, including restoring from a backup: 30 minutes.
    • Editing a cluster: 60 minutes.
    • Deleting a cluster: 15 minutes.

    Operations exceeding the set timeout are interrupted.

    How do I change these limits?

    Add the timeouts block to the cluster description, for example:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.Update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/<cluster_ID>' \
      --data '{
                "updateMask": "configSpec.resources.diskTypeId,configSpec.resources.diskSize",
                "configSpec": {
                  "resources": {
                    "diskTypeId": "<disk_type>",
                    "diskSize": "<storage_size_in_bytes>"
                  }
                }
              }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

    • configSpec.resources: Storage parameters:

      • diskTypeId: Disk type.
      • diskSize: New storage size in bytes.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/postgresql/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "update_mask": {
              "paths": [
                "config_spec.resources.disk_type_id",
                "config_spec.resources.disk_size"
              ]
            },
            "config_spec": {
              "resources": {
                "disk_type_id": "<disk_type>",
                "disk_size": "<storage_size_in_bytes>"
              }
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.postgresql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

    • config_spec.resources: Storage parameters:

      • disk_type_id: Disk type.
      • disk_size: New storage size in bytes.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Setting up automatic increase of storage sizeSetting up automatic increase of storage size

Note

Some PostgreSQL settings depend on the storage size.

Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas page and check the HDD storage capacity and SSD storage capacity lines under Managed Databases to make sure there is available quota for storage space.

Warning

  • You cannot decrease the storage size.
  • While resizing the storage, cluster hosts will be unavailable.
Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for PostgreSQL.

  2. Select the cluster and click Edit in the top panel.

  3. Under Automatic increase of storage size:

    1. In the Increase size field, set the storage utilization percentage to trigger storage increase. You can configure the increase to take place:

      • During the next maintenance window.
      • Right away.

      You can enable both rules, but the threshold for immediate increase should be higher than that for increase during the maintenance window.

      For more information about storage increase conditions, see this section.

    2. In the Maximum storage size field, specify the maximum storage size that can be set when increasing the storage size automatically.

  4. Click Save changes.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To set up automatic increase of storage size:

  1. View the description of the CLI command to update a cluster:

    yc managed-postgresql cluster update --help
    
  2. Set the maximum storage size and conditions for its increase in the update cluster command.

    Make sure the maximum storage size is greater than the disk_size value in the cluster properties. The percentage for immediate increase should be higher than that for increase during the next maintenance window.

    yc managed-postgresql cluster update <cluster_ID_or_name> \
        --disk-size-autoscaling disk-size-limit=<maximum_storage_size_in_bytes>,`
                               `planned-usage-threshold=<scheduled_increase_percentage>,`
                               `emergency-usage-threshold=<immediate_increase_percentage>
    

    If you have set up the storage size to increase within the maintenance window, set up a schedule for the maintenance window.

    For more information about storage increase conditions, see this section.

  1. Open the current Terraform configuration file that defines your infrastructure.

    For more information about creating this file, see Creating clusters.

    For a complete list of available Managed Service for PostgreSQL cluster configuration fields, see the Terraform provider documentation.

  2. Add the disk_size_autoscaling section to config:

      resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
        ...
        config {
          ...
          disk_size_autoscaling {
            disk_size_limit           = <maximum_storage_size_GiB>
            emergency_usage_threshold = <threshold_for_immediate_increase_in_percent>
            planned_usage_threshold   = <threshold_for_scheduled_increase_in_percent>
          }
          ...
        }
        ...
      }
    

    Where:

    • disk_size_limit: Maximum object size after increase, in gibibytes.

    • emergency_usage_threshold: Storage utilization threshold to trigger a storage increase right away, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

      The possible values range from 0 to 100.

    • planned_usage_threshold: Storage utilization threshold to trigger a storage increase during the next maintenance window, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

      The possible values range from 0 to 100.

    For more information about storage increase conditions, see this section.

    Warning

    If you specify both thresholds, emergency_usage_threshold must not be less than planned_usage_threshold.

  3. If you specified the planned_usage_threshold parameter, configure the maintenance window schedule.

  4. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  5. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    Time limits

    A Terraform provider sets the timeout for Managed Service for PostgreSQL cluster operations:

    • Creating a cluster, including restoring from a backup: 30 minutes.
    • Editing a cluster: 60 minutes.
    • Deleting a cluster: 15 minutes.

    Operations exceeding the set timeout are interrupted.

    How do I change these limits?

    Add the timeouts block to the cluster description, for example:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.Update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/<cluster_ID>' \
      --data '{
                "updateMask": "configSpec.diskSizeAutoscaling,maintenanceWindow",
                "configSpec": {
                  "diskSizeAutoscaling": {
                    "plannedUsageThreshold": "<threshold_for_scheduled_increase_as_percentage>",
                    "emergencyUsageThreshold": "<threshold_for_immediate_increase_as_percentage>",
                    "diskSizeLimit": "<maximum_storage_size_in_bytes>"
                  }
                },
                "maintenanceWindow": {
                  "weeklyMaintenanceWindow": {
                    "day": "<day_of_week>",
                    "hour": "<hour>"
                  }
                }
              }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

      In this case, provide only configSpec.diskSizeAutoscaling and maintenanceWindow.

    • configSpec: Cluster settings:

      • diskSizeAutoscaling: Automatic storage size increase settings:

        • plannedUsageThreshold: Storage utilization threshold to trigger a storage increase during the next maintenance window, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

          The possible values range from 0 to 100.

        • emergencyUsageThreshold: Storage utilization threshold to trigger a storage increase right away, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

          The possible values range from 0 to 100.

        • diskSizeLimit: Maximum object size after increase, in bytes.

        Warning

        • When using plannedUsageThreshold, make sure to specify the maintenanceWindow setting.

        • If you specify both thresholds, emergencyUsageThreshold must not be less than plannedUsageThreshold.

        For more information about storage increase conditions, see this section.

      Use a percentage value between 0 and 100. The default value is 0 (automatic increase is disabled). This parameter value must be greater than or equal to plannedUsageThreshold.

      • diskSizeLimit: Maximum storage size, in bytes, that can be set when utilization reaches one of the specified percentages.

      For more information about storage increase conditions, see this section.

    • maintenanceWindow: Maintenance window schedule. It is required only if the plannedUsageThreshold parameter is set. Contains the following parameters:

      • day: Day of week, in DDD format, for scheduled maintenance.
      • hour: Hour of day, in HH format, for scheduled maintenance. The possible values range from 1 to 24.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/postgresql/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "update_mask": {
              "paths": [
                "config_spec.disk_size_autoscaling",
                "maintenance_window"
              ]
            },
            "config_spec": {
              "disk_size_autoscaling": {
                "planned_usage_threshold": "<threshold_for_scheduled_increase_as_percentage>",
                "emergency_usage_threshold": "<threshold_for_immediate_increase_as_percentage>",
                "disk_size_limit": "<maximum_storage_size_in_bytes>"
              }
            },
            "maintenance_window": {
              "weekly_maintenance_window": {
                "day": "<day_of_week>",
                "hour": "<hour>"
              }
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.postgresql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

      In this case, provide only config_spec.disk_size_autoscaling and maintenance_window.

    • config_spec: Cluster settings:

      • disk_size_autoscaling: Automatic storage size increase settings:

        • planned_usage_threshold: Storage utilization threshold to trigger a storage increase during the next maintenance window, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

          The possible values range from 0 to 100.

        • emergency_usage_threshold: Storage utilization threshold to trigger a storage increase right away, in percent. This is an optional setting. The default value is 0 (automatic increase is disabled).

          The possible values range from 0 to 100.

        • disk_size_limit: Maximum object size after an increase, in bytes.

        Warning

        • When using planned_usage_threshold, make sure to specify the maintenance_window setting.

        • If you specify both thresholds, emergency_usage_threshold must not be less than planned_usage_threshold.

        For more information about storage increase conditions, see this section.

      For more information about storage increase conditions, see this section.

    • maintenance_window: Maintenance window schedule. It is required only if the planned_usage_threshold parameter is set. Contains the following parameters:

      • day: Day of week, in DDD format, for scheduled maintenance.
      • hour: Hour of day, in HH format, for scheduled maintenance. The possible values range from 1 to 24.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

If the specified threshold is reached, the storage size increases differently depending on disk type:

  • For network HDDs and SSDs, by the higher of the two values: 20 GB or 20% of the current disk size.

  • For non-replicated SSDs and ultra high-speed network SSDs with three replicas, by 93 GB.

  • For local SSDs:

    • In an Intel Broadwell or Intel Cascade Lake cluster, by 100 GB.
    • Intel Ice Lake cluster, by 368 GB.

If the threshold is reached again, the storage size will be automatically increased until it reaches the specified maximum. After that, you can specify a new maximum storage size manually.

Was the article helpful?

Previous
Managing backup policies
Next
Maintenance
© 2025 Direct Cursus Technology L.L.C.