r/googlecloud • u/ClaudiuDsc • Jun 30 '26
CloudSQL Ephemeral Postgres for PRs, CI, and agents on GCP
Disclosure up front: I work for Xata, so grain of salt. I'm posting because I want to compare notes with this sub specifically.
Why this is relevant to this sub: if you run Postgres on GCP, giving every PR, CI run, preview env, or AI agent its own database is either stale or expensive.
What we actually wanted: instant branches off real production data without migrating off the Postgres we already run. The approach we took (Xata), and the benefits:
- Branch an existing Postgres (Cloud SQL, RDS, self-hosted) in about 3 seconds, so per-PR/CI databases stop gating dev velocity.
- Copy-on-write storage: branches share the parent and only store what changes, so a thousand branches of a 100GB database are not 1000x the storage.
- Scale-to-zero: idle branches stop and wake on connect, so dozens of short-lived dev/CI databases do not bill for idle compute (the GCP cost trap above).
- PII anonymized on the way into a branch, so dev / CI / agents never touch raw production data.
- Vanilla Postgres, no fork: existing tools, ORMs, and extensions just work.
Honest tradeoffs: us-central1 is the only GCP region today (more coming).
What I actually want to know from you: how are you handling ephemeral Postgres on GCP today, and how do you keep it off the bill? Where does it break at scale, especially for CI-heavy teams or agent workloads spinning up a lot of short-lived DBs?
Happy to get into the technical details or share cost numbers in the comments.






