Cloud SQL for PostgreSQL FAQ


What is Cloud SQL?
Cloud SQL is an easy-to-use service that delivers fully managed SQL databases in the cloud. Cloud SQL provides either MySQL or PostgreSQL databases.
What are the benefits of using Cloud SQL?
Cloud SQL lets you hand off to Google the mundane, but necessary and often time consuming tasks — like applying patches and updates, managing backups and configuring replications — so you can put your focus on building great applications. And because we use standard wire protocols, it’s easy to connect from just about any application, anywhere.
Which database versions are available with Cloud SQL? How are updates managed?

Cloud SQL for PostgreSQL supports PostgreSQL 9.6 and 11.1 Beta. Minor version updates are deployed as they are released, with no further action required on your part. For more information about updates, see What kind of maintenance shutdowns should I expect with my instance?.

To see the current version of your instance, go to the Google Cloud Platform Console, click the instance name to open the Instance details page. Or, you can use the gcloud sql instances describe command.

Does Cloud SQL support all database features?
Cloud SQL supports most common features of PostgreSQL. For a list of all differences between standard PostgreSQL and the functionality Cloud SQL provides, see Differences between Cloud SQL and standard PostgreSQL functionality.
Are there any size or QPS limits?
There are no queries per second (QPS) limits for Cloud SQL instances. For information about connection, size, and App Engine-specific limits, see Quotas and Limits.
How can I be notified when there are any changes to Cloud SQL?
You can sign up for the google-cloud-sql-announce forum where we post announcements and news about Cloud SQL.
How do I report a bug, request a feature, or ask a question?
You can report bugs and request a feature on our google-cloud-sql-discuss group. You can ask a question in Stack Overflow. For other support options, see the Cloud SQL Support page.
Back to top

Getting Started

Why does my new instance with no data show disk space used?
Cloud SQL and the database both use some space for system files and metadata when your instance is created.
Which activation policy should I use?
Generally, you should set your activation policy to ALWAYS. If you are not using your instance, you can set its activation policy to NEVER to avoid instance charges.
Back to top

Data Storage and Replication

Where is my data stored?

PostgreSQL instances: Instance data is stored in the region where the instance resides. Backup data is stored in two regions for redundancy. If there are two regions on a continent, the backup data remains on the same continent. Because there is only one region in Australia, backup data from the Sydney region is also stored in Asia. For the São Paulo region, backup data is also stored in a US-based region.

What is a zone?

A zone is an independent entity in a specific geographical location where you can run your resources. For example, a zone named us-central1-a indicates a location in the central United States.

For more information about zones, see Zone Resources in the Compute Engine documentation.

What are the limits on storage?
For information on storage limits, see Quotas and Limits.
How is my data replicated?

PostgreSQL instances provide a high availability configuration and read replicas.

How does Cloud SQL failover work?

For information about failover, see Overview of the High Availability Configuration.

Is my data encrypted?
Cloud SQL customer data is encrypted when stored in database tables, temporary files, and backups. External connections can be encrypted by using SSL, or by using the Cloud SQL Proxy.
How is encryption managed for data at rest?

Your data is encrypted using the 256-bit Advanced Encryption Standard (AES-256), or better, with symmetric keys: that is, the same key is used to encrypt the data when it is stored, and to decrypt it when it is used. These data keys are themselves encrypted using a master key stored in a secure keystore, and changed regularly.

For more details, see Encryption at Rest in Google Cloud.

How is encryption managed for data in transit?

Google encrypts and authenticates all data in transit at one or more network layers when data moves outside physical boundaries not controlled by Google or on behalf of Google. Data in transit inside a physical boundary controlled by or on behalf of Google is generally authenticated but might not be encrypted by default. You can choose which additional security measures to apply based on your threat model. For example, you can configure SSL for intra-zone connections to Cloud SQL.

For more details, see Encryption in Transit in Google Cloud.

What kind of read replicas can I create?

For more information about read replicas, including use cases for each type, see Replication Options.

Back to top

Backup and Recovery

How do I recover an instance?

To restore to a backup you can use the Google Cloud Platform Console or the gcloud command-line tool. For more details, see Restoring an Instance.

How much do backups cost?

PostgreSQL instances: The most recent 7 automated backups, and all on-demand backups, are retained. They are charged at the backup storage rate.

For more information about instance storage pricing and instance rates, see Pricing.

Back to top

Managing Your Instances

Can I make my database larger or smaller?

You can increase the amount of storage available to your instance at any time without incurring downtime. You cannot decrease the size of the storage of your instance. You can also configure your instance to automatically increase its storage capacity when space is running low. Learn more.

Do I need to use the Google Cloud Platform Console to manage Cloud SQL?
No. All management tasks that can be done via the console can also be done programmatically via the Cloud SQL API, or scripted using the gcloud command-line tool.
What kind of maintenance shutdowns should I expect with my instance?
You can select a maintenance window for your instance, so you can control when maintenance restarts occur. You can also specify whether an instance gets updates earlier or later than other instances in your project. Learn more.

We recommend that you design your applications to deal with situations when your instance is not accessible for short periods of time, such as in a maintenance shutdown. You can test the behavior of your application to a maintenance shutdown by restarting your instance, which has the same effect. In general, we recommend that you use only short-lived connections as well as use exponential back-off for retrying rejected connections. For more guidance see How should I manage connections?.

When a new version starts to be rolled out, a note is added to the Release Notes. Note, however, that not all instances are upgraded to the new release at the same time.

Can I import or export a specific database?
Yes. You can only import or export a specific database; you cannot import or export more than one database at a time. For more information, see Importing Data or Exporting Data.
Can I import or export a CSV file?
PostgreSQL instances do not yet support CSV files for import or export.
Do I need a Cloud Storage account to import or export data to an instance?
Cloud SQL supports importing and exporting databases (compressed or uncompressed SQL dump files) using a Cloud Storage bucket. To import or export using a Cloud Storage bucket, you need to either sign up for a GCP account and create a bucket, or have access to a Cloud Storage bucket in another account. For more information, see Importing Data or Exporting Data.
If I delete my instance, can I reuse the instance name?
Yes, but not right away. The instance name is unavailable for up to a week before it can be reused.
What is the cloudsqladmin database user?
Every Cloud SQL instance includes a database user called cloudsqladmin. You may notice this user if you do a SHOW GRANTS FOR cloudsqladmin@localhost. On some instances this will also show up in the system user table. This user account is used by automated processes that need to access the data in your instance (for example, backing up your instance or performing an import or export).
What level of transaction isolation does Cloud SQL provide?

PostgreSQL instances: Cloud SQL provides Read committed transaction isolation. You can change the transaction isolation level for a specific transaction, but usually the default value is preferred. For more information, see Transaction Isolation in the PostgreSQL documentation.

Back to top

Pricing and Billing

How can I try out Cloud SQL?
The smallest instance is the db-f1-micro. You can use it to try out the service. Note that shared core instances are not covered by the SLA.
How many instances can I create in a project?
For information about the instance limit, see Quotas and Limits.
What size database instance do I need? How much RAM?
In general, you can increase the performance of your database by choosing a larger instance with more RAM and CPU. This increases the performance of many queries that involve large amounts of computation, such as those involving joins, ORDER BYs, or GROUPing, though the performance of updates affecting single rows will not be much affected. For more information about instance sizes and pricing, see the pricing page.
How is use of my instance calculated?

You are charged per minute for the time that your instance is on.

How is storage calculated?
Storage is calculated based on the amount of storage you have provisioned for your instance. Storage for backups is charged by how much space your backups are using. Storage is charged whether your instance is on or off.
How can I see how much I will be charged?
The Billing tab of the Google Cloud Platform Console shows you the charges your instances have incurred since the last bill was issued.
What happens when my instance reaches the allowed size?

If your instance reaches the provisioned storage size, and you do not have automatic storage increase enabled or it has reached its configured limit, future writes to the database are disallowed until you increase the storage size. Increasing the storage size does not require an instance restart or downtime.

Why is my instance suspended?
This is probably due to an issue with your GCP account. You can determine your billing status by filing a Billing Support Request. After the billing issue is resolved, the instance returns to runnable status within a few hours. Note that suspended Second Generation instances are deleted after 90 days.
Why was my instance deleted?
Instances that are suspended for 90 days are deleted. This applies to instances with a state of SUSPENDED. Instances that are stopped, with a state of RUNNABLE, are not deleted.
How can I cancel my Cloud SQL account?
You can deactivate Cloud SQL for a project by visiting the Google Cloud Platform Console, selecting the project, selecting the API service to open the API Dashboard. Find the Cloud SQL API and click Disable for that API.
How do I disable billing?
You can disable billing by clicking Disable billing in the Google Cloud Platform Console Billing & settings pane for a project. If you disable billing, you also disable the Cloud SQL service. Make sure you really want to disable the Cloud SQL service before you disable billing.

After you disable billing, you will receive one last bill for charges that occurred between the beginning of the billing cycle and when you cancelled.

Back to top

Using Cloud SQL with App Engine

Can I connect from App Engine to a PostgreSQL instance?
You can connect from an App Engine application to a PostgreSQL instance, depending on the environment and language you are using. For more information, see Connecting from App Engine.
Can my App Engine in the US access my Cloud SQL instance in the EU (and vice versa)?

If you are connecting to a PostgreSQL instance, your App Engine application does not need to be in the same region. However, a larger distance between your Cloud SQL instance and your App Engine application causes greater latency for connections to the database.

Which GCP database service is right for me?
This depends on the requirements of your application. Google Cloud Platform offers a number of services for storing and retrieving your data. For more information, see Storage Options.
Do I need to install a local database server to use the App Engine Development Server?
No. You can configure App Engine to use either Cloud SQL or a locally installed database server when running on the development server.
What languages can I use to access my instance?
App Engine supports several languages that you can use to connect to your instances. For more information, see Connecting from App Engine.

If you are not using App Engine, you can use any language that has an associated connector or API.

Can I use Django with Cloud SQL?
Yes, Cloud SQL is compatible with Django. See Getting Started with Django.
Which placeholders can I use in my Python query string?
Python users can only use the %s format code in parameter substitution. Therefore, the following statement is invalid: cursor.execute('INSERT INTO entries (guestAge) VALUES (%d)', (age)).
How should I manage connections?

Managing your database connections effectively is an important aspect of database application development, including using connection pooling and exponential backoff. For examples of how to employ these techniques in a variety of languages and frameworks, see Managing database connections.

To learn more about instance connection limits, see Quotas and Limits.

What does a SQLException with message of "Invalid connection ID" mean?
It means that the connection is no longer open on the server and should be discarded by the client.  You do not need to call 'close' on these connections; they are already closed.
Can I access my Cloud SQL instance programmatically outside of App Engine?
Yes. You can access Cloud SQL instances programmatically from external applications using any supported language. You can also connect using JDBC, including writing Apps Script scripts to access your Cloud SQL databases. See Connecting from External Applications.
Back to top
Was this page helpful? Let us know how we did:

Send feedback about...

Cloud SQL for PostgreSQL