Home / Companies / PlanetScale / Blog / Post Details
Content Deep Dive

Approaches to tenancy in Postgres

Blog post from PlanetScale

Post Details
Company
Date Published
Author
-
Word Count
2,964
Language
English
Hacker News Points
-
Summary

The article explores various approaches to implementing multi-tenancy in a PostgreSQL database, focusing on shared-schema, schema-per-tenant, and database-per-tenant methods. Multi-tenancy allows multiple customers (tenants) to use a single database infrastructure while maintaining data isolation. The shared-schema approach, where all tenants share the same database schema but isolate data with a tenant-specific column, is recommended for its simplicity and scalability. Despite the potential for security risks and operational complexities with schema-per-tenant and database-per-tenant methods, these offer increased data isolation, which may be suitable for specific use cases. The text also discusses the importance of protecting tenants from the "noisy neighbor" problem, where one tenant's resource usage affects others. Shared-schema is highlighted as the most scalable and efficient model when implemented with tenant-based data isolation techniques like partitioning, while schema and database-per-tenant models pose challenges in scaling due to increased operational overhead and connection limitations.