O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

NoSQL databases

41.816 visualizações

Publicada em

NoSQL database paradigms, how to query NoSQL, about relationships, comparison with RDBMS

Publicada em: Tecnologia
  • ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐ has really great writers to help you get the grades you need, they are fast and do great research. Support will always contact you if there is any confusion with the requirements of your paper so they can make sure you are getting exactly what you need.
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Free Video Reveals 1 Weird Trick To Cure Vitiligo In 45 Days! Click Here: ➢➢➢ https://j.mp/3kTNHDZ
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • ⇒ www.HelpWriting.net ⇐ is a good website if you’re looking to get your essay written for you. You can also request things like research papers or dissertations. It’s really convenient and helpful.
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • A Proven Drug Free Holistic System For Reversing Vitiligo And Related Skin Disorders. ★★★ https://j.mp/3kTNHDZ
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • I can advise you this service - ⇒ www.WritePaper.info ⇐ Bought essay here. No problem.
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

NoSQL databases

  1. 1. Harri Kauhanen 2010-03-09 NoSQL databases
  2. 2. Database paradigms • Relational (RDBMS) • NoSQL • Key-value stores • Document databases • Wide column stores (BigTable and clones) • Graph databases • Others
  3. 3. Relational databases • ACID (Atomicity, Consistency, Isolation and Durability) • SQL • MySQL, PostreSQL, Oracle, ...
  4. 4. dog bark id: integer id: integer name: varchar dog_id: integer mood: varchar bark: text birthdate: date color: enum comment id: integer bark_id: integer dog_id: integer comment: text id name mood birth_date color 12 Stella Happy 2007-04-01 NULL 13 Wimma Hungry NULL black 9 Ninja NULL NULL NULL
  5. 5. Key-value stores • “One key, one value, no duplicates, and crazy fast.” • It is a Hash! • The value is binary object aka. “blob” – the DB does not understand it and does not want to understand it. • Amazon Dynamo, MemcacheDB, ...
  6. 6. “value” “key” ... name_€#_Stella^^^ mood_€#_Happy^^^ dog_12 birthdate%/// 135465645) ...
  7. 7. Document databases • Key-value store, but the value is (usually) structured and “understood” by the DB. • Querying data is possible (by other means than just a key). • Amazon SimpleDB, CouchDB, MongoDB, Riak, ...
  8. 8. “document” “key” { type: “Dog”, name: “Stella”, dog_12 mood: “Happy”, birthdate: 2007-04-01 } vs. id name mood birth_date color 12 Stella Happy 2007-04-01 NULL 13 Wimma Hungry NULL black 9 Ninja NULL NULL NULL
  9. 9. { type: “Dog”, name: “Stella”, mood: “Happy”, birthdate: 2007-04-01, barks: [ { bark: “I had to wear stupid..” comments: [ { dog_12 dog_id: “dog_4”, comment: “You look so cute!” }, { dog_id: “dog_14”, comment: “I hate it, too!” } ] } ] }
  10. 10. Wide column stores • Often referred as “BigTable clones” • "a sparse, distributed multi-dimensional sorted map" • Google BigTable, Cassandra (Facebook), HBase, ...
  11. 11. “column” “row-id” “column family” “title” “time” “value” dog_12 dog birthdate 15 2007-04-01 dog mood 11 Angry dog mood 45 Happy dog name 25 Stella dog color 34 Black bark text 11 I had to wear...
  12. 12. Graph databases • “Relation database is a collection loosely connected tables” whereas “Graph database is a multi-relational graph”. • Neo4j, InfoGrid, ...
  13. 13. Dog Stella type name mood dog_12 barks bark_59 I had to wear stupid... Happy birth_date comment_to 2007-04-01 comment_83 You look so Cute comments dog_4
  14. 14. • Relationships in RDBMS are “weak”. • You may “define” one by using constraints, documenting a relationship, writing code, using naming conventions etc. • Relationships in graph databases are first class citizens. • There are no relationships in key-value stores, document databases and wide column stores. • You may “define” one by using validations, documenting a relationship, writing code, using naming conventions etc.
  15. 15. • Relational databases have almost limitless indexing, and a very strong language for dynamic, cross-table, queries (SQL) • That’s why they handle all kinds of relationships well and dynamically. • NoSQL databases... • ...might have limited support for dynamic queries and indexing • ...don’t support JOIN like operations of SQL • ...but you can store some relationships into document itself
  16. 16. How to query NoSQL? • Key-Value • Row-id/column-family:title[/time] • “stella_12”/”dogs”:”name” → Stella • Graph traversal • API • Query-language • Integration to indexing and search engines • Map-Reduce
  17. 17. Map-Reduce • “MapReduce is a programming model and an associated implementation for processing and generating large data sets.” • Often JavaScript (NoSQL implementations)
  18. 18. Map-function function map(doc) { if (doc['type'] == 'Dog') { emit(doc['mood'], doc['birthdate']); } } • Generates “indexed view” of data/ documents • This view is just another hash, but both key and value can be “anything”
  19. 19. Reduce-function • Aggregate results for a “view” (after the Map-function) function reduce(mood, listOfBirthdates) { return averageBirthDate(listOfBirthdates); } • Map-phase is easy to distribute, but you is also easy to write poor Reduce-functions
  20. 20. Theorems • CAP • Consistency, Availability, Partition tolerance • “Pick two” • N/R/W (adjusting CAP)
  21. 21. No consistency?
  22. 22. Eventual consistency
  23. 23. Why NoSQL? • Schema-free • Massive data stores • Scalability • Some services simpler to implement than using RDBMS • Great fit for many “Web 2.0” services
  24. 24. Why NOT NoSQL • DRBMS databases and tools are mature • NoSQL implementations often “alpha” • Data consistency, transactions • “Don’t scale until you need it”
  25. 25. RDBMS vs. NoSQL • Strong consistency vs. Eventual consistency • Big dataset vs. HUGE datasets • Scaling is possible vs. Scaling is easy • SQL vs. Map-Reduce • Good availability vs.Very high availability
  26. 26. Questions?

×