MongoDB Schema Design

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

image image

image

Advantages of doc-oriented schema

•Avoid joins
•Disk locality when fetching relations (everything is stored within a doc record)
•Schema-less design

image

 

一对多问题

image

image

image

image

image

本质上讲, 1和2是同一种设计, 只不过2中增加了嵌套, 从而是原来的array结构变成tree结构
3, 其实是类似RDB的设计, 应该不常采用, 虽然flexible, 但读效率应该比较低

 

多对多问题

image

image

image

image 

第二种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的比较麻烦

posted on 2013-04-28 15:51  fxjwind  阅读(986)  评论(0编辑  收藏  举报