为复杂案例选择哪种DB类型(关系/ NoSQL和哪种类型)

时间:2016-01-06 16:15:36

标签: mysql relational-database scalable nosql

对于我们的某项SaaS服务,我们会调查使用哪个数据库,因为我们会从头开始重新设计它。

我们当前的解决方案使用MySQL并为每个新客户创建一个单独的数据库。当前(全球)结构是:

- globaldb.globaltable
    => some global data shared with all customers
    => big
    => it would be an option to flatten this data in the customerdb.tablewithreportlines, but this increases the size quite a bit

- customerdb.tablewithstaticdata
    => joins with `globaltable`
    => searched on several columns
    => no group by
    => writes throughout the day, in the thousands
    => reads on request by the customer via the application, so not continuesly
    => can be big per customer, serveral GBs

- customerdb.tablewithreports
    => searched on several columns
    => writes throughout the day, but only in the tens
    => reads on request by the customer via the application, so not continuesly
    => quite small

- customerdb.tablewithreportlines
    => joins with `tablewithreports`
    => joins with `globaltable`
    => most columns are 'searchable'
    => most columns are 'groupable'
    => writes throughout the day, in the thousands but only when processing the `tablewithreports` lines
    => reads on request by the customer via the application, so not continuesly
    => can be big per customer, serveral GBs

customerdb数据永远不会 UPDATEd ,但只会 INSERTed (偶尔也会 DELETEd )。

我们正在为快速增长做准备,需要一个为此做好准备的结构。可以手动添加新实例(如果需要)。

我们之前有一个MySQL设置,其中包含大量用于测试项目的表(和数据库)。该项目失败,因为服务器超过了MySQL表的最大文件处理程序。这大约是+ -500.000表。这个新项目肯定需要能够处理500,000个客户,因此需要150万个表(使用此当前结构)。

每个客户数据库的平均大小为+ - 7,5Mb。没有多少,但由于几个客户的数据库中有多个GB,因此它非常普及。

我搜索了SO和Google以找到匹配的情况,但无法找到它。

此时我们对任何关系,NoSQL或组合的建议持开放态度,因为我们正在进行全面的重新设计。

问题此用例最适合的数据库是什么?

PS:这是我的第一篇文章,原谅我的“我不完整”

1 个答案:

答案 0 :(得分:0)

我建议考虑为所有客户使用通用数据库。这大大减少了表的数量。

数据库管理系统并非针对这么大的数据库或表格而设计。

通常,表是表示同类对象集合的一个实体。因此,所有相同类型的对象(如您的情况下的客户)应放在一个表中,而不是为每个客户都有一个单独的表。

相关问题