'How to decrease storage size for PostgreSQL on Google Cloud?

I moved some of my data from PostgreSQL to BigQuery.

Before PostgreSQL database was using 130 GB of storage, now I only need 30GB.

However, in the Google Cloud Console GUI, I still see that PostgreSQL still allocating 130 GB of storage, while 100GB of it is empty (see the attached screenshot).

Does it mean that Google Cloud is still charging me for 130GB of storage? What can I do to get rid of that unused storage space?

Screenshot from Google Cloud



Solution 1:[1]

It is currently impossible to reduce the storage capacity of a Cloud SQL instance. The storage allocation is permanent and cannot reduce only increased. However, there is a feature request for reducing the capacity of a Cloud SQL instance that is worth following for future updates.

To use a smaller storage capacity, export data as an SQL dump file and then, configure a new Cloud SQL instance with the desired capacity. Then import the SQL dump file to store all your data in the new instance. To achieve efficient and less expensive imports/exports follow these best practices from the documentation.

Solution 2:[2]

It's impossible to decreace Storage size(capacity) for **all PostgreSQL, MySQL and SQL Server on Cloud SQL. Only increasing Storage size is possible and Yes, GCP is still charging you for 130GB storage cost.

If you really want to decreace Storage size from 130 GB to 30GB on Cloud SQL, you can export the data from the existing instance :

enter image description here

Then, import the data into the new instance created with the Storage size 30 GB. This way, you can decreace Storage size from 130 GB to 30GB on Cloud SQL:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrew
Solution 2