0
votes

I am building a SaaS application which is multi-tenant, and there is a separate DB for each tenant.

I am using the domain to detect the client from my landlord DB.

My question is, should I be creating a unique DB user for each tenant DB and connecting using those credentials, or is it just as good to use one ‘global’ user which can access the landlord and all tenant DB’s?

1
You can do either method, but you'll quickly regret creating tens of thousands of databases when you have to apply a migration to each of them sequentially. - tadman

1 Answers

0
votes

Strictly from a programming point of view, it does not matter which sokution you choose.

However, having a separate database per tenant suggests that you need higher degree of separation between tenant data. If you use a single database user to all databases, then having separate databases is not really worth it as an application error could expose tenants' data to each other despite having separate databases.