Relational Databases on GCP: Cloud SQL, AlloyDB, High Availability, Read Replicas and Backups

Google Cloud Platform Architect 55 min min read Updated: Nov 17, 2026 Intermediate
Relational Databases on GCP: Cloud SQL, AlloyDB, High Availability, Read Replicas and Backups
Intermediate Topic 1 of 3

Managed Relational Databases

A relational database stores data in tables and uses SQL. Managed means Google handles patching, backups, replication and failover, and you handle schema, queries, access and sizing.

Cloud SQL

  • Supports MySQL, PostgreSQL and SQL Server
  • Vertical scaling by changing the machine size and storage (storage can auto-increase)
  • Editions: Enterprise and Enterprise Plus (higher performance, availability and maintenance downtime near zero)
  • Good for web apps, CMS, small to medium transactional systems (up to a few TB)
bash gcloud sql instances create shop-db --database-version=POSTGRES_16 --edition=ENTERPRISE --tier=db-custom-2-8192 --region=asia-south1 \ --availability-type=REGIONAL --storage-size=100GB --storage-auto-increase --backup-start-time=21:00 --enable-point-in-time-recovery \ --network=projects/my-proj/global/networks/prod-vpc --no-assign-ip gcloud sql databases create shopdb --instance=shop-db gcloud sql users create appuser --instance=shop-db --password=CHANGE-ME

High Availability and Replicas

FeaturePurposeNotes
HA (regional) configurationStandby in another zone. Automatic failover (about a minute or two)Synchronous replication. Not for read scaling
Read replicaOffload reads, reportingAsynchronous. Can be cross-region. Can be promoted for disaster recovery
Cascading replicasReplica of a replicaFor many readers
Cross-region DR replicaRecover from a regional outagePromote it, then repoint apps

Backups and Recovery

  • Automated backups (daily window, retention up to 365 days) and on-demand backups
  • Point-in-time recovery (PITR) replays logs to any second in the retention window. Restore creates a new instance
  • Export to Cloud Storage as SQL or CSV for archives and migration
bash gcloud sql backups create --instance=shop-db gcloud sql instances clone shop-db shop-db-restore --point-in-time=2026-11-17T08:30:00Z gcloud sql export sql shop-db gs://acme-backups/shopdb.sql --database=shopdb gcloud sql instances failover shop-db # test HA failover

Connecting Safely

  • Use private IP (private services access or Private Service Connect). Avoid public IP
  • Use the Cloud SQL Auth Proxy or language connectors for encrypted, IAM-authenticated connections
  • Enable IAM database authentication where supported
  • Store passwords in Secret Manager
  • Use connection pooling (PgBouncer) for many short connections, for example from Cloud Run
bash ./cloud-sql-proxy --private-ip my-proj:asia-south1:shop-db & psql "host=127.0.0.1 user=appuser dbname=shopdb"

Maintenance

  • Set a maintenance window and deny periods (for busy sales days)
  • Choose Enterprise Plus for near-zero downtime maintenance

AlloyDB for PostgreSQL

  • Google's PostgreSQL-compatible database with a disaggregated storage layer, built for high performance (much faster for transactions and analytics queries than standard PostgreSQL, according to Google)
  • Features: columnar engine for analytic queries, read pools, 99.99 percent availability SLA with HA, built-in AI features such as vector search and model integration
  • Choose when you outgrow Cloud SQL PostgreSQL or want one database for transactions and real-time analytics

Cloud SQL or AlloyDB or Spanner?

NeedChoose
MySQL or SQL Server, simple, low costCloud SQL
PostgreSQL, standard workloadCloud SQL for PostgreSQL
PostgreSQL with very high performance, HTAP, vectorsAlloyDB
Relational with global scale and horizontal writesSpanner
Oracle workloadsBare Metal Solution or migrate

Practice

  1. Create a regional Cloud SQL PostgreSQL instance with private IP
  2. Connect with the Auth Proxy and create a table
  3. Add a read replica and send read queries to it
  4. Clone the instance to a point in time
  5. Delete the instances when finished

Conclusion

Cloud SQL provides managed MySQL, PostgreSQL and SQL Server with HA, replicas, backups and PITR. Use private IP and the Auth Proxy for safe access. AlloyDB is the high-performance PostgreSQL option, and Spanner is for global scale.

Quick Summary: managed; Cloud SQL; HA; backups; connecting; maintenance; AlloyDB; choosing.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators