多个数据库与一个数据库,其中ID用于分隔组织

时间:2021-08-14 12:32:40

In the situation of a web application that organizations can sign up for and use to manage data, what are the pros and/or cons of the two following options?

在组织可以注册并用于管理数据的Web应用程序的情况下,以下两个选项的优点和/或缺点是什么?

  • One database per organization where the data for each organization is entirely separated into individual databases, with one (very small) centralized database that keeps a basic listing of the organizations and their database identifiers.

    每个组织一个数据库,其中每个组织的数据完全分成单独的数据库,其中一个(非常小的)集中式数据库保存组织及其数据库标识符的基本列表。

  • One database for the entire application where all the entities are stored in one large database and separated using an organization identifier column on each table.

    整个应用程序的一个数据库,其中所有实体都存储在一个大型数据库中,并使用每个表上的组织标识符列进行分隔。

Some other aspects to consider:

其他一些方面需要考虑:

  • Data will never be shared between organizations in the database, nor will login credentials.
  • 数据永远不会在数据库中的组织之间共享,登录凭据也不会。
  • Some organizations will allow the general public to register an account with the application to submit data, others will not.
  • 一些组织将允许公众在申请中注册帐户以提交数据,而其他组织则不会。
  • We plan on exposing a public API for organizations to integrate their current processes with our application. Organizations will be able to generate API keys to allow access to their data, but there won't be a public API that spans organizations.
  • 我们计划为组织公开一个公共API,以便将他们当前的流程与我们的应用程序集成。组织将能够生成API密钥以允许访问其数据,但不会有跨组织的公共API。
  • Companies will be storing potentially sensitive data in the application.
  • 公司将在应用程序中存储可能敏感的数据。

From your experience and/or knowledge, what is the right way to go about this design decision (or is there a "right" way at all?)

根据您的经验和/或知识,这个设计决策的正确方法是什么(或者是否有“正确”的方式?)

3 个解决方案

#1


8  

Here is an in-depth discussion on MSDN (Multi-Tenant Data Architecture).

以下是对MSDN(多租户数据架构)的深入讨论。

I would add that there is no right/wrong way. It all depends on requirements, existing expertise and cost.

我想补充说,没有正确/错误的方式。这一切都取决于要求,现有的专业知识和成本。

#2


5  

You might find Joel Spolsky's comments on this topic interesting. Here's a transcript of the podcast in which Joel discussed the multi-tenant database architecture of Fogbugz:

您可能会发现Joel Spolsky对此主题的评论很有趣。这是播客的成绩单,其中Joel讨论了Fogbugz的多租户数据库架构:

https://*.fogbugz.com/default.asp?W24218

https://*.fogbugz.com/default.asp?W24218

(search the transcript for the question starting at [50:45])

(从[50:45]开始搜索问题的成绩单)

#3


0  

One consideration that might be interesting:

一个可能有趣的考虑因素:

if you have a single database for all orgs, and those orgs are spread all across the 24 time zones, then this requires a 24/24 (and perhaps 7/7) DBMS. Not all products have that, I believe.

如果所有组织都有一个数据库,并且这些组织遍布24个时区,则需要24/24(也许是7/7)DBMS。我相信并非所有产品都有。

#1


8  

Here is an in-depth discussion on MSDN (Multi-Tenant Data Architecture).

以下是对MSDN(多租户数据架构)的深入讨论。

I would add that there is no right/wrong way. It all depends on requirements, existing expertise and cost.

我想补充说,没有正确/错误的方式。这一切都取决于要求,现有的专业知识和成本。

#2


5  

You might find Joel Spolsky's comments on this topic interesting. Here's a transcript of the podcast in which Joel discussed the multi-tenant database architecture of Fogbugz:

您可能会发现Joel Spolsky对此主题的评论很有趣。这是播客的成绩单,其中Joel讨论了Fogbugz的多租户数据库架构:

https://*.fogbugz.com/default.asp?W24218

https://*.fogbugz.com/default.asp?W24218

(search the transcript for the question starting at [50:45])

(从[50:45]开始搜索问题的成绩单)

#3


0  

One consideration that might be interesting:

一个可能有趣的考虑因素:

if you have a single database for all orgs, and those orgs are spread all across the 24 time zones, then this requires a 24/24 (and perhaps 7/7) DBMS. Not all products have that, I believe.

如果所有组织都有一个数据库,并且这些组织遍布24个时区,则需要24/24(也许是7/7)DBMS。我相信并非所有产品都有。