Database / Supabase Intermediate to Advanced Interview Questions
What is the difference between schema-per-tenant and RLS-based multi-tenancy?
Schema-per-tenant gives each customer their own Postgres schema (or even database), with identical table structures duplicated per tenant; isolation is structural — a query simply cannot reach another tenant's schema unless explicitly told to.
| Schema-per-tenant | RLS-based (shared schema) |
| Strong structural isolation | Isolation enforced by policy, not structure |
| Migrations must run per schema | One migration applies to all tenants |
| Scales poorly past many tenants | Scales well to thousands of tenants |
RLS-based multi-tenancy instead keeps every tenant's rows in the same shared tables, distinguished by a tenant_id column, and relies on a policy like tenant_id = current_tenant() to enforce isolation. It's the more common Supabase pattern because a single migration updates every tenant at once and it scales to far more tenants than provisioning a schema per customer would allow, at the cost of isolation being a policy you must get right rather than a structural guarantee.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
