logoalt Hacker News

steveBK123yesterday at 1:41 PM1 replyview on HN

With multi-tenant vs multi-database decision one driver would be the level of legal/compliance/risk/cost/resource drivers around how segregated users really are.

Multi-database is more expensive generally but is a more brain dead guaranteed way to ensure the users are properly segregated, resilient across cloud/database/etc software releases that may regress something in a multi-tenant setup.

Multi-tenant you always run the risk of a software update, misconfiguration or operational error exposing existence of other users / their metadata / their data / their usage / etc. You also have a lot more of a challenge engineering for resource contention.


Replies

zieyesterday at 9:43 PM

Agreed, in Multi-tenant, where the user/customer owns the data, I always reach for SQLite first. Each user/customer gets their own SQLite DB. Then you have a common PG/SQLite DB for any common metadata, billing, etc.

That way when a customer leaves or they want a backup copy of their data, it's a rm <customer>.sqlite3 or .backup away.

Sometimes you can't do that for various (almost always non-technical) reason(s), but it's always my 1st choice.