English Casual 2012/05/10

2,257 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,257
On SlideShare
0
From Embeds
0
Number of Embeds
1,050
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • English Casual 2012/05/10

    1. 1. English CasualI started to use MongoDB 2012/05/10 riywo
    2. 2. Developing Web App❖ I wanted to build a Web App❖ Renewal of Management Tool ❖ High performance is unnecessary❖ Present: MySQL Schema ❖ Too many relations ❖ Fuckin’!!!
    3. 3. SELECT u.name, c.name, a.code ...FROM users uLEFT JOIN map USING(user_id)LEFT JOIN classes c USING(class_id)LEFT JOIN addresses a USING(user_id)WHERE c.categ = ?AND u.age >= ? AND ...
    4. 4. Schema less!!
    5. 5. Features of MongoDB “Schema-less”❖ MongoDB stores “documents” as BSON(binary JSON) ❖ without CREATE TABLE or ALTER TABLE ❖ TABLE => collection, RECORD => document❖ Powerful Query ❖ next...
    6. 6. db.users.find( {address.city:{$in:["tokyo",...]}}, {name:1}).sort({age:-1}).limit(10).skip(5)
    7. 7. Features of MongoDB “Schema-less”❖ Point: “Denormalize” as much as you can ❖ not using relation or mapping table ❖ embedding to the document’s column❖ ...Why?
    8. 8. Features of MongoDB “no JOIN”❖ MongoDB doesn’t support JOIN !❖ If you want to JOIN multi collections, you should do it on application side ❖ find document => lookup reference => find document ❖ some drivers support DBRef, but it is just format... ❖ hoge: { $ref:"coll", $id:"id" }❖ So, intentional embedding relational documents is better
    9. 9. Features of MongoDB “no Transaction”❖ MongoDB doesn’t support transaction !❖ MongoDB is designed for updating “one” document ❖ some Atomic operations($inc, findAndModify)❖ It is difficult to update multi documents Atomically ❖ MongoDB update likes MySQL AUTOCOMMIT ’s
    10. 10. Features of MongoDB “no Transaction”❖ If you want to update multi documents ACID-ly... ❖ !!! You should compromise some aspects !!! ❖ Optimistic/Pessimistic Lock ❖ Two Phase Commit ❖ MVCC if possible...
    11. 11. Noooooooo!
    12. 12. I ♡ RDBMS❖ RDBMS have great transaction function❖ Safe for many trouble scenes❖ But RDBMS have some weak points ❖ which are hot spots of NoSQL!❖ So, I should learn about Database more and more ❖ I bought “Database Management Systems” ❖ Let’s read it with me!
    13. 13. Thanks

    ×