one database per client or all clients in one database. which one should I use for a online application?

前端 未结 3 939
庸人自扰
庸人自扰 2021-02-04 17:35

So I have this application that would have multiple modules, from project management to accounting modules. The question is should I have one database per client (company) or o

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 18:05

    1) Having separate databases allows for easier distribution of load on several hosts, it lifts the roof in many ways; disk, memory, locking, cpu, backup-time and so on. If you are serious about putting millions of rows in mysql, it is certainly a good idea with separate databases (not only schemas), and even separate instances, so that the resource-consuming customers won't impose downtime on less resource consuming ones.

    2) It is going to be exactly N times harder to manage where N is the number of databases :o) This extra cost you must compare to the cost of using just one db/schema and instead manage separation of customer in code. It's also inherently much harder to manage if you have to call customer support at your hosting company, or even your local grumpy dba, instead of just running a neat script from your console each time you need to update schema or create a new database.

    Some databases and persistence frameworks have support for multi-tenancy, Oracle has this and support is beginning to emerge in Hibernate 4.

    Even though many arguments point in the direction of separate databases, it is generally possible to use just one database as well.

提交回复
热议问题