
Summary
Key points of this document
- Where are the design challenges?
- How to define boundaries?
- Details that matter in implementation
Overview
When launching multiple business applications, deciding whether to separate or share Cloud SQL per application is a difficult choice. A design is needed that minimizes cost and operations while not excessively broadening the scope of failures. In a design where multiple applications share Cloud SQL, it's more important not to mix data ownership and failure impact than to consolidate connection destinations.
Where are the design challenges?
Having a DB instance for each small application increases costs and management overhead. On the other hand, putting everything into a single Cloud SQL instance expands the impact on connection counts, performance, failures, permissions, and recovery.
Cloud Run tends to increase connection counts during scale-out, which can hit DB-side limits. Also, a heavy query from one application might affect other applications.
Sharing Cloud SQL among multiple small applications can reduce costs and operational overhead. However, issues such as connection limits, migration conflicts, unintended data inclusion during backup restoration, and permission leaks can arise.
How to define boundaries?
If sharing, at a minimum, separate the DB or schema and DB user for each application. Manage connection information, migrations, and backup verification on an application-by-application basis, and clarify the scope of use for Cloud SQL Auth Proxy and IAM.
In design, we consider instance sharing, database separation, schema separation, and table sharing separately. For small applications, a configuration that separates DBs or schemas within the same instance and grants minimal privileges to each application's DB user is easier to manage.
Details that matter in implementation
Pass only the necessary DB user to each Cloud Run service, and limit migrations to the target schema. Configure connection pools and calculate the relationship between maximum instance count and DB connection count. Offload heavy aggregations to jobs.
When connecting from Cloud Run, separate service accounts and DB users per application, and manage connection settings separately. Maintain migration history tables per application, allowing them to be executed independently from CI/CD.
- Even in a shared instance, do not reuse the same DB user across applications.
- Confirm whether restoration is instance-wide or DB-unit-wide, and understand the rollback impact in advance.
- Adjust connection pool limits per application to prevent one application from exhausting all connections.
Observe how failures occur
In verification, we check connection counts per application, incorrect migration application, unauthorized table access, and partial restoration procedures from backups. Load testing will examine connection exhaustion during concurrent access.
In verification, we confirm access denial to unauthorized schemas, migration conflicts during concurrent deployments, connection limits, and backup restoration procedures. For disaster recovery training, we consider scenarios where only one application stops versus when the entire DB stops.
Discarded options and trade-offs
A shared DB reduces costs but cannot provide complete fault isolation. It's necessary to decide to separate high-importance or high-load applications into dedicated instances. A design that starts with sharing and allows for separation as it grows is practical.
Instance sharing is cost-effective, but the impact of failures spreads. Complete isolation is safe but increases operational costs. It's necessary to decide to separate items with different business importance, data sensitivity, and access volumes early on.
Decision criteria to retain in practice
Cloud SQL sharing is not just about using the same connection destination. By designing boundaries for schemas, permissions, connection counts, and recovery, a group of small applications can be operated smoothly.
Cloud SQL sharing is not just a cost-saving measure but a tenancy design. By considering permissions, migrations, connections, and recovery separately, safe sharing is possible even for small-scale operations.


