我应该为多客户端应用程序使用单个或多个数据库设置? [英] Should I use a single or multiple database setup for a multi-client application?

查看:170
本文介绍了我应该为多客户端应用程序使用单个或多个数据库设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一种旨在缓解公司工作流程和项目管理的PHP应用程序,让我们来看看 Basecamp GoPlan

I am working on a PHP application that intends to ease company workflow and project management, let's say something like Basecamp and GoPlan.

我不知道最好的方法是数据库的。我应该使用单个数据库并向每个表添加客户端特定的列,还是应该为每个新客户端创建一个数据库?一个重要的因素是自动化:我想要创建一个新的客户端变得简单(也许开启自己注册的可能性)。

I am not sure on what the best approach is, database-wise. Should I use a single database and add client-specific columns to each of the tables, or should I create a database for each new client? An important factor is automation: I want it to be dead simple to create a new client (and perhaps opening the possibility to signing up for yourself).

可能的缺点我可以想想使用一个数据库:

Possible cons I can think of using one database:


  • 缺少可扩展性

  • 安全问题(尽管错误不应该在那里首先

  • Lack of extensibility
  • Security problems (although bugs shouldn't be there in the first place)

你有什么想法?您有什么想法上述公司最有可能选择哪些解决方案?

What are your thoughts on this? Do you have any ideas what solution the above companies are most likely to have chosen?

推荐答案

我通常将ClientID添加到所有表中,并使用一个数据库。
但是由于数据库通常很难扩展,我还可以在某些或所有客户端的不同数据库实例上运行。

I usually add ClientID to all tables and go with one database. But since the database is usually hard to scale I will also make it possible to run on different database instances for some or all clients.

这样你可以在一个数据库中有一堆小客户端,而在独立的服务器上有大量的小客户端。

That way you can have a bunch of small clients in one database and the big ones on separate servers.

可维护性的一个关键因素是,保持模式在所有数据库中相同。在不引入客户端特定模式的情况下,头痛足以管理版本控制。

A key factor for maintainability though, is that you keep the schema identical in all databases. There will be headache enough to manage the versioning without introducing client specific schemas.

这篇关于我应该为多客户端应用程序使用单个或多个数据库设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆