Jump to Content
Google Cloud

Digging in on Cloud SQL automatic storage increases

September 21, 2016
Greg Wilson

Director, Developer Advocacy

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:

  1. 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.
  2. 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.

https://storage.googleapis.com/gweb-cloudblog-publish/images/cloud-sql-automatic-storage-increasespkpn.max-700x700.PNG

According to the documentation, Cloud SQL determines how much capacity to add in the following way: “The size of the threshold and the amount of storage that is added to your instance depends on the amount of storage currently provisioned for your instance, up to a maximum size of 25 GB. The current storage capacity is divided by 25, and the result rounded down to the nearest integer. This result is added to 5 GB to produce both the threshold size and the amount of storage that is added in the event that the available storage falls below the threshold.”

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.

Posted in