There’s a cool new setting in the storage dialog of Cloud SQL Second Generation: “Enable automatic storage increase.” When selected, it checks the available database storage every 30 seconds and adds more capacity as needed in 5GB to 25GB increments, depending on the size of the database. This means that instead of having to provision storage to accommodate future database growth, storage capacity grows as the database grows.
There are two key benefits to Cloud SQL automatic storage increases:
- Having a database that grows as needed can reduce application downtime by reducing the risk of running out of database space. You can take the guesswork out of capacity sizing without incurring any downtime or performing database maintenance.
- If you're managing a growing database, automatic storage increases can save a considerable amount of money. That’s because allocated database storage grows as needed rather than you having to provision a lot of space upfront. In other words, you pay for only what you use plus a small margin.
Expressed as a JavaScript formula, that translates to the following (units=GB):
Math.min((Math.floor(currentCapacity/25) + 5),25)
Here’s what that looks like for a few database sizes:
Current capacity
|
Threshold
|
Amount auto-added
|
50GB
|
7GB
|
7GB
|
100GB
|
9GB
|
9GB
|
250GB
|
15GB
|
15GB
|
500GB
|
25GB
|
25GB
|
1000GB
|
25GB
|
25GB
|
5000GB
|
25GB
|
25GB
|
If you already have a database instance running on Cloud SQL Second generation, you can go ahead and turn this feature on now.