文章目錄
- Relational vs. Documentoriented
http://www.blogjava.net/czihong/archive/2012/02/18/370250.html, Schema Design for MongoDB
http://docs.mongodb.org/manual/core/data-modeling/, Data Modeling Considerations for MongoDB Applications
http://www.slideshare.net/kbanker/mongodb-schema-design, MongoDB Schema Design
http://www.slideshare.net/jetlore/mongodb-schema-design-insights-and-tradeoffs-jetlore-mongosf-2012?ref=http://www.10gen.com/presentations/mongodb-schema-design-insights-and-tradeoffs, MongoDB Schema Design: Insights and Tradeoffs (Jetlore's talk at MongoSF 2012)
http://www.slideshare.net/mongodb/schema-design-short?from=ss_embed, MongoDB Schema Design Basic
關於MongoDB的schema設計, 上面3篇ppt講的比較清晰
其實本身也比較簡單.
Relational vs. Documentoriented
Advantages of doc-oriented schema
•Avoid joins
•Disk locality when fetching relations (everything is stored within a doc record)
•Schema-less design
一對多問題
本質上講, 1和2是同一種設計, 只不過2中增加了嵌套, 從而是原來的array結構變成tree結構
3, 其實是類似RDB的設計, 應該不常採用, 雖然flexible, 但讀效率應該比較低
多對多問題
第二種alternative的方案, 減少了儲存空間, 因為在category中沒有儲存相應的products_id
作為tradeoff, 當查詢category對應的products時, 就非常麻煩需要去product裡面去遍曆.
MongoDB Schema Design Vs. HBase Schema Design(HBase-TDG Schema Design)
MongoDB Schema設計和HBase的相比, 主題還是Denormalization, 避免join
但是MongoDB的更為簡單,
Document的表達能力更強, 設計的時候更為方便.
MongoDB的index和MySQL沒啥區別, 都是使用B樹, 所以使用起來更熟悉. 而對於HBase索引機制是LSM-tree, 尤其當需要secondary index的比較麻煩