Percona Live 2017 Open Source Database Conference

April 24 - 27, 2017

Santa Clara, California

Designing your SaaS Database for Scale with Postgres

Designing your SaaS Database for Scale with Postgres

 25 April - 2:20 PM - 3:10 PM @ Room 203
Experience level: 
50 minutes conference
Tools and Techniques


If you’re building a SaaS application, you probably already have the notion of tenancy built in your data model. Typically, most information relates to tenants / customers / accounts and your database tables capture this natural relation. With smaller amounts of data, it’s easy to throw more hardware at the problem and scale up your database. As these tables grow however, you need to think about ways to scale your multi-tenant database across dozens or hundreds of machines. In this talk, we're first going to talk about motivations behind scaling your SaaS (multi-tenant) database and several heuristics we found helpful on deciding when to scale. We'll then describe three design patterns that are common in scaling SaaS databases: (1) Create one database per tenant, (2) Create one schema per tenant, and (3) Have all tenants share the same table(s). Next, we'll highlight the tradeoffs involved with each design pattern and focus on one pattern that scales to hundreds of thousands of tenants. We'll also share an example architecture from the industry that describes this pattern in more detail. Last, we'll talk about key PostgreSQL properties, such as semi-structured data types, that make building multi-tenant applications easy. We'll also mention Citus as a method to scale out your multi-tenant database. We'll conclude by answering frequently asked questions on multi-tenant databases and Q&A.


Ozgun Erdogan

CTO, Citus Data


Ozgun is the CTO at Citus Data. Prior to Citus, Ozgun worked as a software developer for four years in the Distributed Systems Engineering team at Amazon. There, he proposed, designed, and implemented novel algorithms on distributed caching and consistency; and also worked on building systems for scalable data analytics. Ozgun earned his M.S. in Computer Science from Stanford University, and his B.S. from Galatasaray University. He also holds patents on distributed cache consistency and load balancing.

Lukas Fittl's picture

Lukas Fittl

Citus Cloud, Citus Data


Lukas' work is focused on making distributed databases easier to use, and is a member of the Citus Cloud team. He is also the author of activerecord-multitenant, a Ruby library that enables easy scaling for multi-tenant applications. He has contributed multiple tools to the PostgreSQL ecosystem, such as pg_query and pganalyze. He has spoken about his work at conferences like PGConf US and Strangeloop. Initially from Austria, he's previously been in the Founding Team of Product Hunt (acquired by AngelList), as well as and Spark59.

Share this talk