• Non ci sono risultati.

open-­‐source, high-­‐performance, document-­‐oriented database

N/A
N/A
Protected

Academic year: 2022

Condividi "open-­‐source, high-­‐performance, document-­‐oriented database"

Copied!
35
0
0

Testo completo

(1)

open-­‐source,  high-­‐performance,   document-­‐oriented  database

(2)

RDBMS

(Oracle,  MySQL)

New Gen. OLAP

(vertica,  aster,  greenplum)

Non-relational

Operational Stores

(“NoSQL”)

(3)

non-­‐relational,  next-­‐generation  

operational  datastores  and  databases

NoSQL Really Means:

(4)

Horizontally Scalable Architectures

no  joins no  complex  transactions

+

(5)

New Data Models

no  joins no  complex  transactions

+

(6)

New Data Models

improved  ways  to  develop  applications?

(7)

Data Models

Key  /  Value

memcached,  Dynamo

Tabular

BigTable

Document  Oriented

MongoDB,  CouchDB,  JSON  stores

(8)

Focus on performance

depth  of  functionality scalability  &  performance memcached

key/value

RDBMS

(9)

JSON-style Documents

{“hello”:  “world”}

\x16\x00\x00\x00\x02hello

\x00\x06\x00\x00\x00world

\x00\x00

http://bsonspec.org

represented  as  BSON

(10)

Flexible “Schemas”

{“author”:  “mike”,  “text”:  “...”}

{“author”:  “eliot”,  “text”:  “...”,

 “tags”:  [“mongodb”]}

(11)

Dynamic Queries

(12)

Atomic Update Modifiers

(13)

Focus on Performance

(14)

Replication

master

slave slave slave

master slave

master slave

master master

slave master

(15)

Auto-sharding

client

mongos ...

mongos mongod mongod

mongod mongod

mongod mongod

...

Shards

mongod

mongod mongod Config Servers

(16)

Many Supported

Platforms / Languages

(17)

Best Use Cases

The  Web

Caching

The  Web Scaling  Out

High  Volume

(18)

Less Good At

highly  transactional

ad-­‐hoc  business  intelligence

problems  that  require  SQL

(19)

A Quick Aside

special  key present  in  all  documents unique  across  a  Collection any  type  you  want

_id

(20)

Post

{author:  “mike”,

 date:  new  Date(),

 text:  “my  blog  post...”,

 tags:  [“mongodb”,  “intro”]}

(21)

Comment

{author:  “eliot”,

 date:  new  Date(),

 text:  “great  post!”}

(22)

New Post

post  =  {author:  “mike”,    date:  new  Date(),

   text:  “my  blog  post...”,

   tags:  [“mongodb”,  “intro”]}

db.posts.save(post)

(23)

Embedding a Comment

c  =  {author:  “eliot”,    date:  new  Date(),

   text:  “great  post!”}

db.posts.update({_id:  post._id},  

                               {$push:  {comments:  c}})

(24)

Posts by Author

db.posts.find({author:  “mike”})

(25)

Last 10 Posts

db.posts.find()

               .sort({date:  -­‐1})                .limit(10)

(26)

Posts Since April 1

april_1  =  new  Date(2010,  3,  1)

db.posts.find({date:  {$gt:  april_1}})

(27)

Posts Ending With ‘Tech’

db.posts.find({text:  /Tech$/})

(28)

Posts With a Tag

db.posts.find({tags:  “mongodb”})

...and Fast

db.posts.ensureIndex({tags:  1})

(multi-­‐key  indexes)

(29)

Indexing / Querying on Embedded Docs

db.posts.ensureIndex({“comments.author”:  1}) db.posts.find({“comments.author”:  “eliot”})

(dot  notation)

(30)

Counting Posts

db.posts.count()

db.posts.find({author:  “mike”}).count()

(31)

Basic Paging

page  =  2

page_size  =  15

db.posts.find().limit(page_size)

                             .skip(page  *  page_size)

(32)

Migration: Adding Titles

post  =  {author:  “mike”,

               date:  new  Date(),

               text:  “another  blog  post...”,                tags:  [“mongodb”],

             title:  “MongoDB  for  Fun  and  Profit”}

post_id  =  db.posts.save(post)

(just  start  adding  them)

(33)

$gt,  $lt,  $gte,  $lte,  $ne,  $all,  $in,  $nin

db.posts.find({$where:  “this.author  ==  ‘mike’  ||

                                               this.title  ==  ‘foo’”})

Advanced Queries

(34)

Other Cool Stuff

aggregation  and  map/reduce capped  collections

unique  indexes mongo  shell

GridFS geo

(35)

Download MongoDB

http://www.mongodb.org

and  let  us  know  what  you  think

@mdirolf        @mongodb

slides  will  be  up  on  http://dirolf.com

Riferimenti

Documenti correlati

On the one hand, we aim at evaluating how security impacts on network performance, i.e., how security services (e.g., confidentiality and/or authenticity and replay detection)

The pit-to-crack transition occurring in the very early stage of the corrosion fatigue damage, approximately within the 5% of the average life, is characterized by the formation

Il secondo esperimento, più significativo per il confronto dei due database in fase di interrogazione, consiste nel popolare i due database con gli stessi dati, ovvero per

Il formato OpenDocument (ODF), abbreviazione di OASIS (*) Open Document Format for Office Applications, è un formato aperto (basato su una versione pubblica di XML) per

● The written exam and programming project are independent, and can be completed in any order. ● Grades are valid until September

• A general-purpose speculative simulation kernel based on both state saving and reversibility. • Targets complete transparency towards the

Le tappe di questa evoluzione architetturale hanno riguardato dapprima i sistemi vetto- riali mono-processore (come per esempio, il Cray 1, e il CDC Cyber 203) poi, a partire dai

“Morphology, Water Temperature and Climate,” in The Alte Donau: Successful Restoration and Sustainable Management - An Ecosystem Case Study of a Shallow Urban Lake (Aquatic