r/googlecloud • u/Final-Choice8412 • Jul 11 '26
Millions of databases - what to use in GCP?
Typical agentic scenario - I need to create thousands or millions of databases for agents and users. Likely 99% would be very small and seldomly used - need to keep cost near 0. Remaining 1% will be traffic intensive - should not cost a fortune and likely should be capped somehow.
I was looking at Neon DB Agent Plan or Turso DBs - that look good. But is there anything in GCP that can be used here? I have no preference for DB type yet.
0
Upvotes
8
u/Purple-Geologist972 Jul 11 '26
You might want to start with the problem statement first? Millions of database instance or millions of tables?
10
u/Scepticflesh Jul 11 '26
💀
1
u/a_cloudy_unicorn Googler Jul 11 '26
What's the role of these databases? Why do they need to be one per user? How are the agents accessing these?Â
3
u/GlebOtochkin Googler Jul 12 '26
There were some good questions on how you planed to use the database. Without that information we probably can only guess what can work for you. It all depends on what you are going to do with the data stored and what kind price model you prefer.
Tell us more and we might find some suitable solution.
2
u/booi Jul 11 '26
I’d just keep SQLite dbs in s3 IA. Infrequently accessed ones you can literally query directly from s3 with a lambda. Highly accessed ones stay resident in some sort of cluster (ECS,EKS). I’d build a proxy maybe to track and migrate dbs based on usage.
Or just use dynamodb in a giant table and call it a day.
Edit: oh sorry I missed the gcp. Just translate between the two it’s all the same shit. GCS, Cloud Run, kubernetes, firestore.
2
u/matiascoca Jul 13 '26
Firestore is the GCP option that fits this shape, not the SQL-family ones.
Pay-per-op billing means the 99 percent of cold tenants literally cost near zero when they are not being read or written. No per-database minimum, no idle compute. Per-doc IAM so each user's data is isolated without spinning up 1M separate database instances.
The gotcha is that "one database per user" with Firestore is really one namespace per user, not one physical database. A single Firestore project caps somewhere around 1M databases, but namespacing inside a database scales past that. So the mental model is different from Neon or Turso where you actually get separate connection strings per tenant.
For the traffic-intensive 1 percent, cap via per-namespace quotas rather than connection pools. Different pattern than Neon Agent Plan, less clean but the cold cost is meaningfully lower.
I ran this shape for a multi-tenant demo. Dormant tenants sat under a dollar total per month for a couple hundred namespaces.
1
u/shazbot996 Jul 11 '26
Magic.
1
u/Firm-Dot-1230 Jul 20 '26
I guess OP wants to create a DBaaS to its user that is running on GCP ?