开发者

Multiple Tables or Multiple Schema

开发者 https://www.devze.com 2022-12-25 04:05 出处:网络
Postgresql: is it better using multiple databases with 1 schema each, or 1 database with multiple schemas?

Postgresql: is it better using multiple databases with 1 schema each, or 1 database with multiple schemas?

I am new in schema concept for PostgreSQL.

For the above mentioned scenario, I was wondering

  1. Why don't we use a single database (with default schema named public)
  2. Why don't we have a single table, to store multiple users 开发者_StackOverflowrow?
  3. Other tables which hold users related information, with foreign key point to the user table.

Can anyone provide me a real case scenario, which single database, multiple schema will be extremely useful, and can't solve by conventional single database, single schema.


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

There are several reasons why one might want to use schemas:

*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 analogous to directories at the operating system level, except that schemas cannot be nested.

0

精彩评论

暂无评论...
验证码 换一张
取 消