Difficulty: Intermediate
Estimated Time: 5-10 minutes

In this tutorial, we will use a sample ad analytics dataset to demonstrate how you can use Citus to power your multi-tenant application.

With this, we come to the end of our tutorial on using Citus to power a simple multi-tenant application. As a next step, you can look at the Distributing by Tenant ID section to see how you can model your own data for multi-tenancy.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Multi-tenant Applications

Step 1 of 4

Data model and sample data

We will demo building the database for an ad-analytics app which companies can use to view, change, analyze and manage their ads and campaigns (see an example app). Such an application has good characteristics of a typical multi-tenant system. Data from different tenants is stored in a central database, and each tenant has an isolated view of their own data.

We will use three Postgres tables to represent this data. To get started, we prepared three csv files to these tables;

  • companies.csv
  • campaign.csv
  • ads.csv