How to Shrink Azure Postgres Flexible Storage With Minimal Downtime

Sachin Soam 0 Reputation points
2024-07-12T13:13:58.97+00:00

Could you help me shrink the storage of an Azure PostgreSQL Flexible Server from 2000GB to a more appropriate because used space is only 300GB?

The issue was occurred when the database on auto-grow and the storage consumption suddenly increased from 50% to 100%.

I have tried using Data Migration Service (DMS) for online migration but didn't find an option to migrate from one Azure PostgreSQL Flexible Server to another on the same target.

Azure Database Migration service
Azure Database for PostgreSQL
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 19,426 Reputation points Microsoft Employee
    2024-07-12T16:25:33.19+00:00

    @Sachin Soam Thank you for reaching out.

    Decreasing server storage size is currently not supported. The only way to do is dump and restore it to a new Azure Database for PostgreSQL flexible server instance.

    After you configure the storage size, you can't reduce it. You have to create a new server with the desired storage size, perform a manual dump and restore operation, and migrate your databases to the new server.

    When the storage usage reaches 95% or if the available capacity is less than 5 GiB (whichever is more), the server is automatically switched to read-only mode to avoid errors associated with disk-full situations. In rare cases, if the rate of data growth outpaces the time it takes to switch to read-only mode, your server might still run out of storage. You can enable storage auto grow to avoid these issues and automatically scale your storage based on your workload demands.

    We recommend setting alert rules for storage used or storage percent when they exceed certain thresholds so that you can proactively take action such as increasing the storage size. For example, you can set an alert if the storage percentage exceeds 80% usage.

    For the migration part you mentioned above, migration from one Azure PostgreSQL Flexible Server to another is not available. DMS does not support that.

    User's image

    The issue occurred when the database on auto-grow and the storage consumption suddenly increased from 50% to 100%.

    Storage autogrow using Azure portal in Azure Database for PostgreSQL - Flexible ServerUser's image

    1 person found this answer helpful.
    0 comments No comments

  2. Sachin Soam 0 Reputation points
    2024-07-15T05:41:18.28+00:00

    @Oury Ba-MSFT Thank you so much for your detailed response. I really appreciate the time you took to explain the process and the limitations of reducing storage size. Your guidance has been invaluable. Thanks again!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.