Multi tenant database the good, the bad, the ugly
summary
Examines real-world tradeoffs: a single-instance multi-tenant deployment reaches 24,000 tables and ~1M indexes and shows why tenant_id columns break planner statistics and bloat indexes; row-level security proved fragile and slow when retrofitted; one-database-per-tenant works but hits connection scaling, solved only by pgBouncer and sharding at thousands of tenants; a schema-per-tenant approach suffers from search_path normalization and makes pg_stat_statements hit memory limits; backups and restores fail at scale until pgbackrest repo-bundle reduces millions of small files.
AI-written summary · about
chapters (20)
- 0:00Introduction and background
- 1:03Production database scale horror
- 2:10What is multi-tenant system
- 3:34Implementing multi-tenancy wrong
- 5:00PostgreSQL extensions for multi-tenancy
- 7:53Monitoring tools limitations
- 10:28Row-level security disaster story
- 12:59One database per tenant approach
- 15:13Connection pooling challenges
- 16:38PG Stat Statements failure
- 19:10Logical replication pain
- 21:00One schema per tenant method
- 23:32Backup tools breakdown
- 26:02Backup restoration failures
- 28:57PG Stat Statements schema issues
- 31:05Connection pooling inefficiencies
- 32:11Monitoring multi-tenant chaos
- 36:08Summary of pitfalls
- 37:57Testing before committing
- 38:37Q&A session
