2016-01-06 88 views
0

對於我們的SaaS服務之一,我們正在調查使用哪個數據庫,因爲我們正在從頭開始重新設計它。爲複雜案例選擇哪種數據庫類型(關係/ NoSQL和哪種類型)

我們目前的解決方案使用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數據是從來沒有更新,但只有插入(和刪除偶爾)。

我們正在爲快速增長做準備,需要爲此做好準備的結構。手動添加新實例(如果需要)是可以接受的。

我們早些時候曾經爲一個測試項目建立了一個包含大量表(和數據庫)的MySQL設置。該項目失敗,因爲服務器超過了MySQL表的最大文件處理程序。這是在約-500.000表。這個新項目肯定需要能夠處理500,000個客戶,因此需要處理150萬個表格(採用這種當前結構)。

每個客戶數據庫的平均大小爲+ - 7.5Mb。沒有多少,但它是相當傳播的,因爲多個客戶的數據庫中有多個GB。

我已經搜索過和谷歌找到匹配的情況,但無法找到它。

在這一點上,我們願意接受任何建議,無論是關係型,NoSQL還是組合,因爲我們正在進行全面的重新設計。

問題什麼是最適合這種用例的數據庫?

PS:這是我的第一篇文章所以請原諒我,我不完全

回答

0

我建議考慮使用一個共同的數據庫爲所有的客戶。這從根本上減少了表的數量。

數據庫管理系統並不是爲這個龐大的數據庫或表而設計的。

通常,表格是代表相同類型對象集合的一個實體。因此,所有相同類型的對象(例如您的案例中的客戶)應放置在一張桌子上,而不是爲每個客戶單獨放置一張桌子。