我想創建類似於卡桑德拉數據庫嵌套數據模型:Cassandra嵌套鍵值。更好的方案?
Forums = {
forum001: {
name: "General News",
topics: {
topic000001: {
subject: "This is what I think",
date: "2012-08-24 10:12:13",
posts: {
post20120824.101213: { username: "tom", content: "Blah blah", datetime: "2012-08-24 10:12:13" }
post20120824.101513: { username: "dick", content: "Blah blah blah", datetime: "2012-08-24 10:15:13" }
post20120824.103213: { username: "harry", content: "Blah blah", datetime: "2012-08-24 10:32:13" }
}
},
topic000002: {
subject: "OMG Look at this",
date: "2012-08-24 10:42:13",
posts: {
post20120824.104213: { username: "tom", content: "Blah blah", datetime: "2012-08-24 10:42:13" }
post20120824.104523: { username: "dick", content: "Blah blah blah", datetime: "2012-08-24 10:45:23" }
post20120824.104821: { username: "harry", content: "Blah blah", datetime: "2012-08-24 10:48:21" }
}
}
}
},
forum002: {
name: "Specific News",
topics: {
topic000003: {
subject: "Whinge whine",
date: "2012-08-24 10:12:13",
posts: {
post20120824.101213: { username: "tom", content: "Blah blah", datetime: "2012-08-24 10:12:13" }
post20120824.101513: { username: "dick", content: "Blah blah blah", datetime: "2012-08-24 10:15:13" }
}
}
}
}
}
數據的基本設計是彼此內一堆嵌套地圖。 我已經讀過,這是不合理的,因爲查詢這個數據結構的困難。爲了以這種方式構造數據,對於這個問題更好的解決方案是什麼?
你能不能給我一點精度的你是怎樣在堅持卡桑德拉這個? blob,Supercolumns(只有API保留,實際上是組合)或Composibles?或者是上述的混合?這裏給出的模式中的關鍵字,列名或列是什麼? –
我還沒有設計任何這種結構,因爲我想弄清楚如何正確地構造它之前。上面的結構模型是我在概念上想到的,但我寧願擔心功能和速度。 我需要回答了數據庫的主要查詢是: 「給我之間[時間1]和[時間2]與forumID = [ID]的所有帖子」 希望這有助於一點,與功能我需要出數據庫。 – user2356226
謝謝,這有助於很多...我會發佈一個答案。 –