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

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

问题描述

我在该计划​​,以缓解公司的工作流程和项目管理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?

推荐答案

我通常添加客户端ID的所有表和一个数据库去。
但是,由于数据库通常是难以扩展我也将有可能对某些或所有客户不同的数据库实例上运行。

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天全站免登陆