Home

schemapertenant

Schemapertenant is a multitenancy design pattern in which a separate database schema is created for each tenant within a single database deployment. In this approach, all tenants share the same database server and storage resources, but data for each tenant is logically isolated in its own schema.

Overview and operation

A tenant identifier is used by the application to determine which schema to target. Within a relational

Implementation considerations

Common practices include naming each schema after the tenant (or a slug/ID derived from it), provisioning new

Advantages and trade-offs

Schemapertenant provides strong data isolation, easier per-tenant backups and audits, and scalable schema management for many

Applications and related terms

Used in software-as-a-service (SaaS) platforms needing tenant isolation with shared infrastructure. Related concepts include multitenancy, schema-per-tenant

database
that
supports
multiple
schemas
(such
as
PostgreSQL),
each
tenant’s
data
lives
in
a
distinct
schema
that
contains
the
same
set
of
tables,
views,
and
other
objects.
The
application
can
configure
the
database
search
path
or
use
per-tenant
roles
to
ensure
queries
and
migrations
apply
only
to
the
tenant’s
schema.
This
pattern
supports
per-tenant
backups,
restores,
and
migrations
while
keeping
data
physically
separated.
schemas
when
new
tenants
sign
up,
and
maintaining
a
metadata
table
to
map
tenants
to
schemas.
Security
is
typically
enforced
at
the
database
level
through
privileges
tied
to
the
tenant’s
schema
and,
when
needed,
application-layer
access
control.
Migrations
and
seed
data
are
applied
per
schema,
which
can
complicate
tooling
but
enables
isolated
evolution
of
each
tenant’s
data
model.
tenants.
Drawbacks
include
increased
administration
complexity,
potential
schema
proliferation,
and
challenges
with
cross-tenant
analytics
or
global
constraints.
It
is
often
contrasted
with
single-schema
multitenancy
(shared
tables
with
tenant_id)
and
with
separate
databases
per
tenant.
architectures,
and
database-per-tenant
patterns.