Design a multi-tenant SaaS database
PremiumDatabase designMedium
- Multi tenancy
- Row level security
- Tenant isolation
Quick answer
This database design interview question asks you to design a multi-tenant SaaS database. Aim for a design that stores data correctly and serves its main queries well, then explain the schema, keys, indexes and trade-offs. Interviewers want to see how you model entities, choose keys and design for the real access patterns.
The problem
Design a multi-tenant SaaS database for a B2B project-management app like Asana or Jira. Each customer company is a tenant with its own users, projects, tasks, comments, custom fields and files. The hard part is that one tenant must never see or slow down another.
Tenants range from 3-person startups to a 40,000-employee enterprise that wants its data in a specific region and the option of a dedicated database. All tenants run the same application version; schema migrations roll out to everyone.
What must a multi-tenant SaaS database do?
- Tenant lifecycle: Create a tenant, invite users, suspend, export all data, delete after a 30-day grace period.
- Project and task views: A project's tasks filtered by status, assignee and custom field values, sorted by priority or due date, 50 per page, in under 200 ms.
How well must it do it?
- Isolation: No query can ever return another tenant's rows, even with an application bug that forgets a filter.
- Fair sharing: One tenant's heavy report must not slow others below their latency target.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Multi tenancy
- Row level security
- Tenant isolation
- Noisy neighbours
- Tenant sharding
- Schema migrations
How you’ll practise
- Access patterns
- Entities
- Schema
- Indexes and queries
- Scale and consistency
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any database design round.
- Lists the entities and how they relate before writing tables
- Designs the schema around the main access patterns
- Chooses primary keys, foreign keys and indexes with reasons
- Explains where to normalise and where to denormalise
- Considers integrity, transactions and concurrent writes
- Plans for growth: partitioning, archiving and migrations
Questions people ask about this interview question
- Which design type is this question?
- It is a database design question. You design a multi-tenant SaaS database and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
- What should I cover first?
- Start with the entities and the main queries the database must answer. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team