Hide
Go

Using Google Cloud SQL

Python |Java |PHP |Go

This document describes how to use Google Cloud SQL instances with the App Engine Go SDK.

  1. Creating a Cloud SQL instance
  2. Size and access limits

To learn more about Google Cloud SQL, see the Google Cloud SQL documentation.

If you haven't already created a Google Cloud SQL instance, the first thing you need to do is create one.

Creating a Cloud SQL Instance

A Cloud SQL instance is equivalent to a server. A single Cloud SQL instance can contain multiple databases. Follow these steps to create a Google Cloud SQL instance:

  1. Sign into the Google Developers Console.
  2. Create a new project, or open an existing project.
  3. From within a project, select Cloud SQL to open the Cloud SQL control panel for that project.
  4. Click New Instance to create a new Cloud SQL instance in your project, and configure your size, billing and replication options. You'll notice that the App Engine application associated with your current project is already authorized to access this new instance. For more information on app authorization see the Access Control topic in the Cloud SQL docs.

That's it! You can now connect to your Google Cloud SQL instance from within your app, or any of these other methods.

MySQL case sensitivity

When you are creating or using databases and tables, keep in mind that all identifiers in Google Cloud SQL are case-sensitive. This means that all tables and databases are stored with the same name and case that was specified at creation time. When you try to access your databases and tables, make sure that you are using the exact database or table name.

For example, if you create a database named PersonsDatabase, you will not be able to reference the database using any other variation of that name, such as personsDatabase or personsdatabase. For more information about identifier case sensitivity, see the MySQL documentation.

Size and access limits

The following limits apply to Google Cloud SQL:

Instance Connections

  • Each tier allows for maximum concurrent connections and queries. For more information, see the pricing page.
  • There is a limit of 100 pending connections independent of tier.
  • Establishing a connection takes about 1.25 ms on the server side. Given the 100 pending connection limit, this means a maximum of 800 connections per second. If more than 100 clients try to connect simultaneously, some of them will fail.

These limits are in place to protect against accidents and abuse. For questions about increasing these values, contact the [email protected] team.

Instance Size

The size of all instances is limited to 250GB by default. Note that you only pay for the storage that you use, so you don’t need to reserve this storage in advance. If you require more storage, up to 500GB, then it is possible to increase limits for individual instances for customers with a silver Google Cloud support package.

Google App Engine Limits

Requests from Google App Engine applications to Google Cloud SQL are subject to the following time and connection limits:

  • All database requests must finish within the HTTP request timer, around 60 seconds.
  • Offline requests like cron tasks have a time limit of 10 minutes.
  • Requests from App Engine modules to Google Cloud SQL are subject to the type of module scaling and instance residence time in memory.
  • Each App Engine instance cannot have more than 12 concurrent connections to a Google Cloud SQL instance.

Google App Engine applications are also subject to additional Google App Engine quotas and limits as discussed on the Quotas page.