Skip to content
SaaSArchitecture

Row-level security vs. schema per tenant: choosing a multi-tenant SaaS model

Updated 7 min readBy the Brevity Technologies team

On this page

For most new multi-tenant SaaS products, a sensible start is one shared PostgreSQL database with row-level security, moving specific customers to a dedicated database when a contract, regulation or their size demands it. AWS calls that mix the bridge model. We've built multi-tenant platforms for restaurants, clinics and hotels, and this is one of the first decisions on each.

Key takeaways

  • AWS names three models: silo (dedicated), pool (shared) and bridge (a mix).
  • Row-level security adds a safeguard below your application code, if you run under the right role.
  • Table owners bypass policies unless you force them, and superusers always do.
  • Tenant isolation has to cover files, caches, jobs and logs as well as the database.

The three models

AWS's SaaS Lens names three models: silo (dedicated resources), pool (shared resources) and bridge (a mix). In PostgreSQL terms, they usually look like this.

ItemShared tables with row-level securitySchema per tenantDatabase per tenant
AWS modelPoolA form of bridgeSilo
IsolationEnforced by policiesSeparate namespacesStrongest
Cost per tenantLowestLowHighest
Schema changesRun onceRun for every tenantRun for every tenant
One tenant's heavy loadAffects everyoneAffects everyoneMostly contained
Restoring one tenantHardEasierEasiest
Good forMany small customersDozens of mid-sized customersRegulated or very large customers

Sharing infrastructure doesn't lower the bar. AWS says of the pool model that you can't use it as a reason to relax isolation requirements. A customer seeing another customer's data is the failure that ends a SaaS business, whichever model you pick.

What row-level security gives you

Row-level security moves the tenant check below your application code. A forgotten filter in one query then returns nothing, where it would otherwise return another customer's rows. In PostgreSQL, enabling it on a table with no policy means default-deny, which is the safe way to fail.

ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
ALTER TABLE orders FORCE ROW LEVEL SECURITY;

CREATE POLICY tenant_isolation ON orders
  USING (tenant_id = current_setting('app.tenant_id')::uuid);

-- inside each transaction
SET LOCAL app.tenant_id = '...';

Where it can fail

The PostgreSQL documentation spells out the exceptions, and each one has caught teams out:

  • Table owners normally bypass policies unless you use FORCE ROW LEVEL SECURITY.
  • Superusers and roles with BYPASSRLS always bypass them, so your application must not connect as either.
  • Referential integrity checks bypass them too.
  • With a connection pool, a plain SET can leak one tenant's setting into the next request. Use SET LOCAL inside a transaction.

Write a test that creates two tenants and tries to read across them through your real application role. Run it on every deploy, because the failure is silent until a customer reports it.

Isolation doesn't stop at the database

Most leaks we'd worry about sit around the database. Carry the tenant ID through all of these:

  • File storage paths and signed URLs
  • Cache keys, where a missing tenant prefix serves one customer's page to another
  • Background jobs, which run outside the request that set the tenant
  • Search indexes and analytics exports
  • Logs, and anything sent to an AI model

When to give a tenant its own database

AWS notes that a silo model trades economies of scale for needs like compliance. In practice, move a tenant when a contract or regulation requires it, when their load affects everyone else, or when they need their own restore point or data location. Keep the tenant lookup in one place from the start, so that moving one customer is a routing change and not a rewrite.

How we'd decide

  1. Start by listing who the customers are: how many, how large, and whether any are regulated.
  2. If you expect many small customers, start with shared tables and row-level security.
  3. Route every data access through one tenant-aware layer, so you can change models later.
  4. Add the cross-tenant test before the first real customer.
  5. Offer a dedicated database as a paid option when a customer needs one.

See how this looks in practice in our Quick Bite Now case study, or talk to us about custom software and SaaS.

Frequently asked questions

What is multi-tenant SaaS?

It's one application serving many customer organizations, with each customer's data kept apart. AWS's SaaS Lens describes the options as silo (dedicated resources), pool (shared resources) and bridge (a mix of the two).

Is row-level security enough to isolate tenants?

It's a strong safeguard for the database, but it isn't the whole job. PostgreSQL superusers and roles with BYPASSRLS always bypass policies, and table owners do too unless you force them. You also need to isolate storage, caches, background jobs, search and logs.

When should a tenant get its own database?

When a contract or regulation requires it, when one customer's load affects the others, or when a customer needs its own restore or data location. AWS notes that a silo model trades economies of scale for that kind of need.

Sources

  1. AWS SaaS Lens: silo, pool and bridge models
  2. AWS: pool isolation (whitepaper, kept for historical reference)
  3. AWS: silo isolation (whitepaper, kept for historical reference)
  4. PostgreSQL documentation: row security policies

Checked on November 2, 2026. Rates and rules change, so confirm them at the source before relying on them.

Keep reading.

All insights
AutomationOdoo

How to automate support email with AI on Odoo and Microsoft 365

Read post
WhatsAppHospitality

WhatsApp chatbots for hotels: upsell flows guests don't mind

Read post

Tell us what's slowing your team down.

One call is usually enough to tell whether software is the answer, and what to build first if it is.