Multiple tables or multiple schemas

Postgresql: is it better to use multiple databases with 1 schema or 1 database with multiple schemas?

I am new to the concept of schema for PostgreSQL.

For the above scenario, I was wondering

  • Why we do not use a single database (with the standard default public schema)
  • Why don't we have a single table to store multiple user rows?
  • Other tables containing information related to users with a foreign key point to a user table.

Can someone provide me with a real scenario, which separate database, multiple schema will be extremely useful and will not be able to solve the usual single database, one schema.

+3
source share
1 answer

From http://www.postgresql.org/docs/8.4/interactive/ddl-schemas.html

There are several reasons why you can use schemes:

*To allow many users to use one database without interfering with each other.
*To organize database objects into logical groups to make them more manageable.
*Third-party applications can be put into separate schemas so they do not collide with the names of other objects. 

Schemas are similar to directories at the operating system level, except that schemes cannot be nested.

+2
source

Source: https://habr.com/ru/post/1738603/


All Articles