User table in a separate database

Note. I am not going to realize this, but rather a thought experiment.

Suppose I had several services available through a web interface. At least two of them require user registration and some data in the database. Single registration will provide access to all services. Like Google (GMail, Google Docs, etc.).

Will all of these services associated with registered users be in the same database, possibly with table prefixes, what service were they for?

Or does each service have its own database? The only plus I see in this is that it will make the table names clean. At any time when some kind of user interaction is required, interaction with at least two different databases will be required, which, without the need, would complicate sql queries.

Would this suggest that the “big boys” use only one database and load it with many different (and possibly completely unrelated) tables?

+3
source share
6 answers

, . PostgreSQL " " . , . i.e:

  • dblink
  • ( ).
  • ( )
  • ( )

DAL ( DAL) .

+3

, . , . , . , , , .

.

+3

1 / .

+3

, , . , . .

. , , .

+2

; - .

+1

.

( ) . . . , , . ( , , - ) , RI . , , . , .

I would recommend starting with a single database. If your RDBMS supports it, I would organize the components according to SCHEMA, which will allow you to at least maintain a logical separation by design. You can reorganize more easily later.

Many databases have tables that can be considered unrelated. Sometimes in a system you have several networks of entities that are unlikely to connect (sometimes not). You can also use SCHEMA in these cases.

+1
source

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


All Articles