D
D
dskozin2017-04-07 11:31:40
Algorithms
dskozin, 2017-04-07 11:31:40

What is the best way to globally partition data in a DB?

Hello!
Tell me, who had experience in creating SaaS solutions, what mechanism was used for global data sharing? Different databases for each company, or some sign of a company for all data? Or was no global scope used at all, but just entity relationships?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Tiunov, 2017-04-28
@Dizast

https://www.postgresql.org/docs/9.5/static/ddl-sch...
PostgreSQL has schemas. It is an abstraction layer between the database and the table.
There are different schemes for different accounts. You can keep the same tables in them, you can use different ones. Shared tables can be kept in the public schema. Everything is very flexible. The main thing is that your application handles all this business.
Example. The customer account is located on the subdomain customer.saasapp.com or saasapp.com/customer. When accessing this url, the cursor is placed on the corresponding scheme. All calls to the database within this query go to tables within this schema. If the requested table does not exist, then it is searched for in the public schema.

C
chelkaz, 2017-04-10
@chelkaz

Depends on the volume and variety of information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question