Transcript
Page 1: mongoDB: Why it should (not) replace your SQL database?

Maciej Miara, April 2014

Page 2: mongoDB: Why it should (not) replace your SQL database?

• Non-relational database model

• Easy horizontal scalability

• Different data structures:

- key-value store

- key-value cache

- object database

- document store

- graph store

- wide-column store

• Denormalization

Page 3: mongoDB: Why it should (not) replace your SQL database?

Page 4: mongoDB: Why it should (not) replace your SQL database?

Data structure

Page 5: mongoDB: Why it should (not) replace your SQL database?

Data structure

Page 6: mongoDB: Why it should (not) replace your SQL database?

Object ID

ObjectId("507f191e810c19729de860ea")

Seconds since

the Unix epoch

Machine

identifier

Process idCounter, starts with

random value

Page 7: mongoDB: Why it should (not) replace your SQL database?

Schema

Page 8: mongoDB: Why it should (not) replace your SQL database?

Schema

Page 9: mongoDB: Why it should (not) replace your SQL database?

Schema

Second query confirms, that mongo returns null,

when attribute is not found in document

Page 10: mongoDB: Why it should (not) replace your SQL database?

Querying embedded data

Page 11: mongoDB: Why it should (not) replace your SQL database?

Querying embedded data

Page 12: mongoDB: Why it should (not) replace your SQL database?

•db.createCollection("log", { capped : true, size : 5242880, max : 5000 } )

• Good for logs or temporary data

Capped collections

Page 13: mongoDB: Why it should (not) replace your SQL database?

Map-Reduce

Page 14: mongoDB: Why it should (not) replace your SQL database?

Indexes

Page 15: mongoDB: Why it should (not) replace your SQL database?

Geospatial indexes

Page 16: mongoDB: Why it should (not) replace your SQL database?

Geospatial queries

Page 17: mongoDB: Why it should (not) replace your SQL database?

Geospatial queries - examples

Source:

http://docs.mongodb.org

Page 18: mongoDB: Why it should (not) replace your SQL database?

Full text search

Page 19: mongoDB: Why it should (not) replace your SQL database?

Full text search

Supported languages:

danish, dutch, english, finnish, french, german,

hungarian, italian, norwegian, portuguese, norwegian,

rommanian, russian, spanish, swedish, turkish

Source:

http://docs.mongodb.org

Page 20: mongoDB: Why it should (not) replace your SQL database?

Sharding

Page 21: mongoDB: Why it should (not) replace your SQL database?

Sharding

Source:

http://docs.mongodb.org

Page 22: mongoDB: Why it should (not) replace your SQL database?

GridFS

Page 23: mongoDB: Why it should (not) replace your SQL database?

Javascript driven

Page 24: mongoDB: Why it should (not) replace your SQL database?

ACID

Page 25: mongoDB: Why it should (not) replace your SQL database?

Transaction system

Page 26: mongoDB: Why it should (not) replace your SQL database?

Journaling

Page 27: mongoDB: Why it should (not) replace your SQL database?

Write concern

Page 28: mongoDB: Why it should (not) replace your SQL database?

Unacknowledged

Source:

http://docs.mongodb.org

Page 29: mongoDB: Why it should (not) replace your SQL database?

Acknowledged

Source:

http://docs.mongodb.org

Page 30: mongoDB: Why it should (not) replace your SQL database?

Journal acknowledged

Source:

http://docs.mongodb.org

Page 31: mongoDB: Why it should (not) replace your SQL database?

Replica acknowledged

Source:

http://docs.mongodb.org

Page 32: mongoDB: Why it should (not) replace your SQL database?

Some people complain

about Mongo, but…

Page 33: mongoDB: Why it should (not) replace your SQL database?

…they just don’t know,

why they chose it

Page 34: mongoDB: Why it should (not) replace your SQL database?

• „My friend from studies used it”

• „I was just curious”

• „Recommended by other company

(in their project it worked well)”

• „Technical (!) client wanted it”

• „After all-night long party I decided

to use it”

• „I heard that

Microsoft/Google/NYT/(fill in any

corpo you want) uses it”

Page 35: mongoDB: Why it should (not) replace your SQL database?

Do NOT use Mongo, if you:

• like joins

• Need really transactional system

• Have relational data

• Want full ACID without any

compromises

Page 36: mongoDB: Why it should (not) replace your SQL database?

Any questions?

[email protected]


Top Related