优点/缺点使用多个数据库使用VS单一数据库 [英] Pros/Cons Using multiple databases vs using single database

查看:226
本文介绍了优点/缺点使用多个数据库使用VS单一数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要设计出代表多个客户,在SQL
服务器的Windows应用程序。每个客户都有相同的数据模型,但它是独立的。



会是怎样的利弊/缺点使用多个数据库VS使用单一的数据库。



其中之一是做这项工作的最佳方式。如果去为一个单一的数据库,会出现什么步骤来为做



编辑:



一件事。在数据库将在云(Rackspace公司)账户托管


解决方案

不要从多个客户的数据存储在同一个数据库 - 我所知道的公司,不得不花费大量的时间/精力/钱修正这个错误。我甚至知道客户在分享,即使数据库是独立的数据库计算机在所不惜 - 在好的方面,这些客户一般愿意支付额外的硬件




  1. 单独的安全性应该阻止你这样做的问题。


  2. 如果你有一些客户是不愿意升级他们的软件,它可以是非常困难的,如果你有一个共享的数据库结构。与单独的数据库客户继续使用旧的数据库结构,直到他们准备好升级。


  3. 您被人为限制的自然数据分区,可以提供显著的可扩展性您的解决方案。多个客户仍然可以共享一个数据库服务器,他们只看到自己的数据库/目录,也可以在不同的数据库服务器/实例上运行。


  4. 您正在复杂化数据库设计通过有区别,否则会自然分开的客户数据。


  5. 您正在你的数据库速度慢所有表中有更多的行,用起来数据库内存更为迅速。你的数据库也较慢由于引用的局部性的固有优势的丧失。


  6. 数据回滚1客户可以是非常困难,甚至根本不可能随着数据库的增长 - 你必须有自定义的程序,做到这一点是比简单的慢得多,从备份中恢复


  7. 大型数据库可以是非常困难的。及时备份/恢复。


  8. 您的应用程序(S)使用该数据库将难以维持和测试。


  9. 任何错误,可以更加破坏性的,你可以搞砸了所有的客户我的一个错误。




  10. 您防止低延时的可能性能增强,迫使你的数据库到一个位置。


  11. 您将被称为愚蠢的DBA。





在公平,也有一些优势,共享的数据库设计




  1. 公用表模式,码表,存储的特效等只需要保持并存储在1的位置。


  2. 许可费用可能在某些情况下会降低。


  3. 一些维护更容易,但几乎可以肯定的整体使用相结合的办法更糟。


  4. 如果全部/大部分的客户都是非常小的,你可以有一个低通过不合并的服务器(即性价比比较高的)资源利用率​​。您可以通过降低客户的许可,并明确的认识相结合的成本较高,但仍使用不同的数据库较大的客户。你一定需要明确和前期在这种情况下与您的客户。




除了服务器成本分担,这是一个非常糟糕的主意还是 - 但成本可能是一个非常重要的方面太。这实在是对这种做法的唯一理由 - 如果在所有合理的,虽然避免这种


I need to design a windows application which represents multiple "customers" in SQL Server. Each customer has the same data model, but it's independent.

what will be the Pros/Cons Using multiple databases vs using single database.

which one is the best way to do this work. if going for an single database, what will the steps to do for that.

Edited:

One thing is database will be hosted in cloud(rackspace) account.

解决方案

Do not store data from multiple customers in the same database -- I have known companies that had to spend a lot of time/effort/money fixing this mistake. I have even known clients to balk at sharing a database computer even though the databases are separate - on the plus side, these clients are generally willing to pay for the extra hardware.

  1. The problems with security alone should prevent you from ever doing this.

  2. If you have some customers that are unwilling to upgrade their software, it can be very difficult if you have share a database structure. With separate databases a customer continue using the old database structure until they are ready to upgrade.

  3. You are artificially limiting a natural data partition that could provide significant scalability to your solution. Multiple customer can still share a database server, they just see their own databases/catalogs, or they can run on separate database servers / instances.

  4. You are complicating your database design by have to distinguish customer data that would otherwise be naturally separated.

  5. You are making your database slower by having more rows in all tables, using up database memory more rapidly. You database is also slower due to the loss of the inherent advantage of locality of reference.

  6. Data rollback for 1 customer can be very difficult, maybe even essentially impossible as the database grows - you have to have custom procedures to do this that are much slower than a simple restore from backup.

  7. Large databases can be very difficult to backup / restore in a timely manner.

  8. Your application(s) that use the database will be harder to maintain and test.

  9. Any mistakes can be much more destructive as you can mess up all of your clients my a single mistake.

    1. You prevent the possible performance enhancement of low-latency by forcing your database to a single location.

    2. You will be known as the stupid DBA.

In fairness, there are some advantages to a shared database design

  1. Common table schemas, code tables, stored procs, etc. need only be maintained and stored in 1 location.

  2. Licensing costs may be reduced in some cases.

  3. Some maintenance is easier, although almost certainly worse overall using a combined approach.

  4. If all/most of your clients are very small, you can have a low resource utilization by not combining servers (i.e., a relatively high cost). You can mitigate the high cost by combining clients with their permission and explicit understanding, but still use separate databases for larger clients. You definitely need to be explicit and up-front with your clients in this situation.

Except for the server cost sharing, this is a very bad idea still - but cost can be a very important aspect too. This is really the only justification for this approach - avoid this if at all reasonable though.

这篇关于优点/缺点使用多个数据库使用VS单一数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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