flaibo
Data Structure

Data Structure / Schema Choice

Design the data model for a multi-tenant B2B SaaS task-management application on PostgreSQL 15, tuned for heavy read traffic

No card required

What this brief specifies

What's in scope

Eight distinct entity types have to share one schema: tasks, projects, teams, users, comments, attachments, custom fields, and an activity log.

Constraints

Multi-tenancy has to be single-database, not sharded, with strong isolation between tenants and an audit log required for every task change.

Scale to plan for

Up to 10,000 tenants, as many as 1 million tasks within a single tenant, and concurrent editing.

What makes this hard

Eight different entity types have to share one schema across up to 10,000 tenants without a hard per-tenant database boundary, since multi-tenancy here is single-database rather than sharded, meaning the same isolation guarantee has to be enforced consistently across every one of those eight tables, not just the obvious ones like tasks. The audit log requirement adds a second, different obligation, it applies specifically to task changes, so that one entity among the eight needs to preserve a history of state over time, not just its current row, while the rest carry no such burden. Layer the scale on top, up to a million tasks inside a single tenant with people editing concurrently, and a schema shape fine for a typical smaller tenant's dashboard can fail once one tenant alone reaches that row count while sharing the same database and indexes as thousands of others doing the same thing at once.

FounderConsultantCorporateSme

Frequently asked questions

The next multi-tenant schema that has to hold this many entity types under one isolation boundary, while surviving a tenant that scales far past the typical one, benefits from a data model stress-tested against its own worst-case tenant from the start, rather than one designed for the average case and patched once a single large tenant starts to strain it.

Ready to try this in Flaibo?

Get started free

Your context everywhere