SlideShare una empresa de Scribd logo
1 de 100
Not only NoSQL!
  RDB
- PostgreSQL
   MongoDB        20110730
       @choplin
Why Mongo?
http://www.mongodb.org/display/DOCS/Introduction
Document-oriented




      http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
High performance




      http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
High performance
High availability




        http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
High performance
High availability
Easy scalability


        http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
High performance
High availability
Easy scalability
Rich query language

        http://www.mongodb.org/display/DOCS/Introduction
http://www.mongodb.org/display/DOCS/Introduction
Document-oriented




         http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
 Documents (objects) map nicely to
 programming language data types




           http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
 Documents (objects) map nicely to
 programming language data types

 Embedded documents and arrays reduce
 need for joins




           http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
 Documents (objects) map nicely to
 programming language data types

 Embedded documents and arrays reduce
 need for joins

 Dynamically-typed (schemaless) for easy
 schema evolution




           http://www.mongodb.org/display/DOCS/Introduction
Document-oriented
 Documents (objects) map nicely to
 programming language data types

 Embedded documents and arrays reduce
 need for joins

 Dynamically-typed (schemaless) for easy
 schema evolution

 No joins and no multi-document
 transactions for high performance and
 easy scalability

           http://www.mongodb.org/display/DOCS/Introduction
http://www.mongodb.org/display/DOCS/Introduction
High performance




       http://www.mongodb.org/display/DOCS/Introduction
High performance
 No joins and embedding makes reads
 and writes fast




        http://www.mongodb.org/display/DOCS/Introduction
High performance
 No joins and embedding makes reads
 and writes fast

 Indexes including indexing of keys from
 embedded documents and arrays




         http://www.mongodb.org/display/DOCS/Introduction
High performance
 No joins and embedding makes reads
 and writes fast

 Indexes including indexing of keys from
 embedded documents and arrays

 Optional asynchronous writes




         http://www.mongodb.org/display/DOCS/Introduction
Point
No Relation (No Join)
No Transaction
Point
 No Relation (No Join)
 No Transaction



Solved many problems!
Join bother me...
How good?
Exapmple
Exapmple
           Date
Exapmple
           Date
           Title
Exapmple
           Date
           Title
           Tag
Exapmple
           Date
           Title
           Tag


           body
No Join!
> use blog
switched to db blog
> db.post.insert({
  title: " 4 Sugamo.vim         ..."
     ,postDate: new Date(2011, 6, 19)
     ,tag: ["     ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
})
No Join!
> use blog
switched to db blog
> db.post.insert({
  title: " 4 Sugamo.vim ..."
                          It’s embedded!!
  ,postDate: new Date(2011, 6, 19)
  ,tag: ["      ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
})
Array and Object
> db.post.insert({
  title: " 4 Sugamo.vim         ..."
     ,postDate: new Date(2011, 6, 19)
     ,tag: ["     ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
     ,comment: [
       {
          name: “vimmer”
          ,comment: “vim is great!”
       }
       ,{}...
     ]
})
Array and Object
> db.post.insert({
  title: " 4 Sugamo.vim         ..."    Array
     ,postDate: new Date(2011, 6, 19)
     ,tag: ["     ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
     ,comment: [
       {
          name: “vimmer”
          ,comment: “vim is great!”
       }
       ,{}...
     ]
})
Array and Object
> db.post.insert({
  title: " 4 Sugamo.vim        ..."     Array
     ,postDate: new Date(2011, 6, 19)
     ,tag: ["     ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
     ,comment: [
                                Objects   in array
       {
          name: “vimmer”
          ,comment: “vim is great!”
       }
       ,{}...
     ]
})
Embedded
Embedded
Reduce join
Embedded
Reduce join

  Better performance
Embedded
Reduce join

  Better performance

    Join itself (executer)
Embedded
Reduce join

  Better performance

    Join itself (executer)

    Query plan (optimizer)
Embedded
Reduce join

  Better performance

    Join itself (executer)

    Query plan (optimizer)

Reduce impedance mismatch between db
and apps
Embedded
Reduce join

  Better performance

    Join itself (executer)

    Query plan (optimizer)

Reduce impedance mismatch between db
and apps

Also easy to understand :)
Embedded
Reduce join

  Better performance

    Join itself (executer)

    Query plan (optimizer)

Reduce impedance mismatch between db
and apps

Also easy to understand :)
          but, still have to consider a lot ...
Things to be considered
Things to be considered

Document size limitation (16MB)
Things to be considered

Document size limitation (16MB)

Write / Read ratio
Things to be considered

Document size limitation (16MB)

Write / Read ratio

Type of query
Things to be considered

Document size limitation (16MB)

Write / Read ratio

Type of query

In-place update
Things to be considered

Document size limitation (16MB)

Write / Read ratio

Type of query

In-place update

etc.
More detail
Official : Schema design

   http://www.mongodb.org/display/DOCS/Schema+Design

MongoDB Schema Design - MongoSF 2011

   http://speakerdeck.com/u/kbanker/p/mongodb-schema-design-
   mongosf-2011

MongoDB Schema Design : myNoSQL

   http://nosql.mypopescu.com/post/907003504/mongodb-schema-
   design

MongoDB                     Relation

   http://d.hatena.ne.jp/masa_w/20101130/1291084939
More detail




Schema Design     ?
Anyway,
Great Feature!
Wait!
I can!
Array

blog=# CREATE TABLE post (
  id int
  ,title text
  ,postDate date
  ,tag text[]
  ,body text
);
Array

blog=# CREATE TABLE post (
  id int
  ,title text    Array of text
  ,postDate date
  ,tag text[]
  ,body text
);
Array
blog=# INSERT INTO post VALUES
   (
     1
     ,’ 4 Sugamo.vim ...’
   ,’2011/7/19’
   ,ARRAY[‘          ’, ‘vim’]
    ,’Sugamo.vim 7/19 ...’
  );
Array
blog=# INSERT INTO post VALUES
   (
     1
     ,’ 4 Sugamo.vim ...’
                          Array literal
     ,’2011/7/19’
     ,ARRAY[‘     ’, ‘vim’]
    ,’Sugamo.vim 7/19 ...’
  );
Array


blog=# SELECT tag FROM post

           tag
      --------------
       {     ,vim}
      (1 row)
has Array!


※SQL Standard (SQL99)
Difference
Difference

Dynamically typed
{
    tag : [1, ‘two’, new Date()]
}
Difference

Dynamically typed
{
    tag : [1, ‘two’, new Date()]
}

 Statically typed
SELECT ARRAY[1, 2, 3]::int[]
Array utilities
Array to string


> db.post.findOne({tag:"vim"}).tag.join(',')

                      ,vim
Array to string


blog=# SELECT array_to_string(tag, ',') FROM post;

                array_to_string
               -----------------
                      ,vim
               (1 row)
String to array


> db.post.findOne{tag:"vim"}).body.split(' ')

      [ "Sugamo.vim", "7/19", "..." ]
String to array


blog=# SELECT string_to_array(body, ' ') FROM post;

                 string_to_array
              ----------------------
               {Sugamo.vim,7/19,..}
              (1 row)
array to row


blog=# SELECT unnest(body, ' ') FROM post;

                 unnest
                --------


                 vim
                (2 rows)
row to array

blog=# SELECT array_agg(v) FROM (
          SELECT unnest(tag, ' ') v FROM post
        ) t;
                   array_agg
                --------------
                 {       ,vim}
                (1 row)
Indexing an array
Indexing
   > db.post.ensureIndex({tag:1});
   > db.post.find({tag:"vim"}).explain()
{
                                        "isMultiKey" : true,
! "cursor" : "BtreeCursor
                                        ! "indexOnly" : false,
tag_1",
                                        ! "indexBounds" : {
! "nscanned" : 1,
                                        ! ! "tag" : [
! "nscannedObjects" : 1,
                                        ! ! ! [
! "n" : 1,
                                        ! ! ! ! "vim",
! "millis" : 0,
                                        ! ! ! ! "vim"
! "nYields" : 0,
                                        ! ! ! ]
! "nChunkSkips" : 0,
                                        ! ! ]
!
                                        ! }
                                        }
                   http://www.slideshare.net/matsuou1/20110514-mongo-db
Indexing


blog=# CREATE INDEX on post USING gin(tag);



     ※Gin : Generalized Inverted Index
Indexing

blog=# set enable_seqscan = off;
blog=# EXPLAIN SELECT * FROM post WHERE tag @> ARRAY['vim']



                           QUERY PLAN
---------------------------------------------------------------------------
 Bitmap Heap Scan on post (cost=4.26..8.27 rows=1 width=104)
   Recheck Cond: (tag @> '{vim}'::text[])
   -> Bitmap Index Scan on post_tag_idx (cost=0.00..4.26 rows=1 width=0)
       Index Cond: (tag @> '{vim}'::text[])
(4 rows)
Both use
Inverted Index
Inverted Index

          Data                         Index
T0 = "it is what it is",         "a":    {2}
T1 = "what is it",               "banana": {2}
T2 = "it is a banana"            "is":  {0, 1, 2}
                                 "it":  {0, 1, 2}
                                 "what": {0, 1}


      http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE
      %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
Inverted Index

          Data                          Index
T0 = "it is what it is",         "a":    {2}
T1 = "what is it",               "banana": {2}
T2 = "it is a banana"            "is":  {0, 1, 2}
                                 "it":  {0, 1, 2}
                                 "what": {0, 1}

                                  key
      http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE
      %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
Inverted Index

          Data                         Index
T0 = "it is what it is",         "a":     {2}
T1 = "what is it",               "banana": {2}
T2 = "it is a banana"            "is":   {0, 1, 2}
                                 "it":   {0, 1, 2}
                                 "what": {0, 1}
                                        posting list
                                  key
                                           /bucket
      http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE
      %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
Inner Structure
key tree
Inner Structure
             posting tree
key tree
             /bucket tree
Inner Structure
              posting tree
key tree
              /bucket tree




               ※ Wanted!
            More precise info
           at MongoReading :)
Aggregate
Map/Reduce
map = function() {
    if (!this.tags) {
        return;
    }

    for (index in this.tags) {
        emit(this.tags[index], 1);
    }
}


            http://cookbook.mongodb.org/patterns/count_tags/
Map/Reduce
reduce = function(previous, current) {
    var count = 0;

    for (index in current) {
        count += current[index];
    }

    return count;
}


               http://cookbook.mongodb.org/patterns/count_tags/
Map/Reduce
> result = db.runCommand({
... "mapreduce" : "posts",
... "map" : map,
... "reduce" : reduce,
... "out" : "tags"})

 > db.tags.find()
 { "_id" : "vim", "value" : 1 }
 { "_id" : "       ", "value" : 1 }


           http://cookbook.mongodb.org/patterns/count_tags/
Group By
blog=# SELECT tag, count(tag) FROM (
         SELECT unnest(tag, ' ') tag FROM post
        )t
        GROUP BY tag;

                tag   | count
              --------+-------
                     |     1
               vim     |     1
              (2 rows)
Semi-structured
Object
> db.post.insert({
  title: " 4 Sugamo.vim         ..."
     ,postDate: new Date(2011, 6, 19)
     ,tag: ["     ", "vim"]
     ,body: "Sugamo.vim 7/19 ..."
     ,comment: [
       {
                                        Object
          name: “vimmer”
          ,comment: “vim is great!”
       }
       ,{}...
     ]
})
Some choice
contrib/hstore
# SELECT ‘a => 1, b => 2’::hstore

"a"=>"1", "b"=>"2"


Type for group of (key => value)

Can be indexed with Gin/GiST

Can’t be nested ....
XML Type
<book>
  <title>                             </title>
  <author>               </author>
  <author>               </author>
  <publisher>            </publisher>
 </book>




                http://lets.postgresql.jp/documents/tutorial/xml/1/
XML Type

testdb=# CREATE TABLE t_books(books xml);



testdb=# INSERT INTO t_books(books) VALUES('
testdb'# <book>
testdb'# <title>                       </title>
testdb'#   <author>           </author><author>                    </author>
testdb'#   <publisher>        </publisher>
testdb'# </book>
testdb'# ');


                            http://lets.postgresql.jp/documents/tutorial/xml/1/
XML Type

testdb=# SELECT
          xpath('/book[author/text()="                 "/title', books)
        FROM
         t_books;

                              xpath
          ---------------------------------------------
           {<title>                      </title>}
          (1 rows)




                           http://lets.postgresql.jp/documents/tutorial/xml/1/
XML Type


Access element with xpath()

Can be indexed with xpath/Functional Index




                 http://lets.postgresql.jp/documents/tutorial/xml/1/
JSON Type


Being implemented ...

        9.2?
hardly get along with
 relational model ...
Why Mongo?
The Scripting Language
              of Databases




            $m = new Mongo();
            $m->test->formResults->insert($_POST);
            print_r($m->test->formResults->findOne());

http://www.snailinaturtleneck.com/blog/2011/04/06/the-scripting-language-of-databases/
Philosophy




  http://www.mongodb.org/display/DOCS/Philosophy
My Opinion


Use Mongo instead of ORM!
  (or write SQL directly)


       ORM                                       11
       http://tech.a-listers.jp/2011/06/16/orm_is_an_antipattern/
Thank you !

Más contenido relacionado

La actualidad más candente

Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyMark Needham
 
Demystifying PostgreSQL (Zendcon 2010)
Demystifying PostgreSQL (Zendcon 2010)Demystifying PostgreSQL (Zendcon 2010)
Demystifying PostgreSQL (Zendcon 2010)NOLOH LLC.
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingNeo4j
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database JonesJohn David Duncan
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile applicationFabrizio Giudici
 
Writing A Foreign Data Wrapper
Writing A Foreign Data WrapperWriting A Foreign Data Wrapper
Writing A Foreign Data Wrapperpsoo1978
 
NoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовNoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовCodeFest
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDBJeff Yemin
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181Mahmoud Samir Fayed
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDBJames Williams
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebChristian Baranowski
 
Database madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyDatabase madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyJaime Buelta
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212Mahmoud Samir Fayed
 

La actualidad más candente (20)

Graph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easilyGraph Connect: Importing data quickly and easily
Graph Connect: Importing data quickly and easily
 
Demystifying PostgreSQL (Zendcon 2010)
Demystifying PostgreSQL (Zendcon 2010)Demystifying PostgreSQL (Zendcon 2010)
Demystifying PostgreSQL (Zendcon 2010)
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data Modelling
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and Modeling
 
MongoDB-SESSION03
MongoDB-SESSION03MongoDB-SESSION03
MongoDB-SESSION03
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database Jones
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile application
 
Writing A Foreign Data Wrapper
Writing A Foreign Data WrapperWriting A Foreign Data Wrapper
Writing A Foreign Data Wrapper
 
NoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовNoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросов
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDB
 
ERRest and Dojo
ERRest and DojoERRest and Dojo
ERRest and Dojo
 
Gl qtp day 3 2
Gl qtp day 3   2Gl qtp day 3   2
Gl qtp day 3 2
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181
 
Java development with MongoDB
Java development with MongoDBJava development with MongoDB
Java development with MongoDB
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web Stack
 
Latinoware
LatinowareLatinoware
Latinoware
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
 
Realm to Json & Royal
Realm to Json & RoyalRealm to Json & Royal
Realm to Json & Royal
 
Database madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyDatabase madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemy
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212
 

Destacado

NoSQL and Architectures
NoSQL and ArchitecturesNoSQL and Architectures
NoSQL and ArchitecturesEberhard Wolff
 
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages  NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages DATAVERSITY
 
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLKeshav Murthy
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for BeginnersEnoch Joshua
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesQuery mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesArangoDB Database
 
Virtual personal assistant
Virtual personal assistantVirtual personal assistant
Virtual personal assistantShubham Bhalekar
 
Cicret bracelet seminar report by Likhith.N
Cicret bracelet seminar report by Likhith.NCicret bracelet seminar report by Likhith.N
Cicret bracelet seminar report by Likhith.NLikhith95
 
Tik (inovasi teknologi masa depan)
Tik (inovasi teknologi masa depan)Tik (inovasi teknologi masa depan)
Tik (inovasi teknologi masa depan)اندك فرنوا
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...Amazon Web Services
 
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSOR
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSORDUAL AXIS SOLAR TRACKER USING LDR AS A SENSOR
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSORSwetanshmani Shrivastava
 

Destacado (16)

NoSQL and Architectures
NoSQL and ArchitecturesNoSQL and Architectures
NoSQL and Architectures
 
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages  NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages
NoSQL Now! Webinar Series: Innovations in NoSQL Query Languages
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Seminar
SeminarSeminar
Seminar
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for Beginners
 
Cicret Bracelet
Cicret BraceletCicret Bracelet
Cicret Bracelet
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesQuery mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
 
Virtual personal assistant
Virtual personal assistantVirtual personal assistant
Virtual personal assistant
 
Cicret bracelet seminar report by Likhith.N
Cicret bracelet seminar report by Likhith.NCicret bracelet seminar report by Likhith.N
Cicret bracelet seminar report by Likhith.N
 
Tik (inovasi teknologi masa depan)
Tik (inovasi teknologi masa depan)Tik (inovasi teknologi masa depan)
Tik (inovasi teknologi masa depan)
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
 
Introduction to Amazon DynamoDB
Introduction to Amazon DynamoDBIntroduction to Amazon DynamoDB
Introduction to Amazon DynamoDB
 
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSOR
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSORDUAL AXIS SOLAR TRACKER USING LDR AS A SENSOR
DUAL AXIS SOLAR TRACKER USING LDR AS A SENSOR
 
Deep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDBDeep Dive: Amazon DynamoDB
Deep Dive: Amazon DynamoDB
 

Similar a Mongo db勉強会20110730

Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchEelco Visser
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know Norberto Leite
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)MongoDB
 
The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185Mahmoud Samir Fayed
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the CloudJames Thomas
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP formatForest Mars
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHPichikaway
 
New in MongoDB 2.6
New in MongoDB 2.6New in MongoDB 2.6
New in MongoDB 2.6christkv
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
AMD - Why, What and How
AMD - Why, What and HowAMD - Why, What and How
AMD - Why, What and HowMike Wilcox
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBMongoDB
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBMongoDB
 
Refresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End StoryRefresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End StoryRachael L Moore
 

Similar a Mongo db勉強会20110730 (20)

Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language Workbench
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP format
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
New in MongoDB 2.6
New in MongoDB 2.6New in MongoDB 2.6
New in MongoDB 2.6
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
AMD - Why, What and How
AMD - Why, What and HowAMD - Why, What and How
AMD - Why, What and How
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDB
 
Refresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End StoryRefresh Tallahassee: The RE/MAX Front End Story
Refresh Tallahassee: The RE/MAX Front End Story
 
Slickdemo
SlickdemoSlickdemo
Slickdemo
 

Más de Akihiro Okuno

qpstudy 2013.07 NoSQL
qpstudy 2013.07 NoSQLqpstudy 2013.07 NoSQL
qpstudy 2013.07 NoSQLAkihiro Okuno
 
カジュアルにソースコードリーディング
カジュアルにソースコードリーディングカジュアルにソースコードリーディング
カジュアルにソースコードリーディングAkihiro Okuno
 
Write parser with fun!
Write parser with fun!Write parser with fun!
Write parser with fun!Akihiro Okuno
 
groonga with PostgreSQL
groonga with PostgreSQLgroonga with PostgreSQL
groonga with PostgreSQLAkihiro Okuno
 
Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Akihiro Okuno
 
第一回Mongo dbソースコードリーディング 20110628
第一回Mongo dbソースコードリーディング 20110628第一回Mongo dbソースコードリーディング 20110628
第一回Mongo dbソースコードリーディング 20110628Akihiro Okuno
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL TigerAkihiro Okuno
 

Más de Akihiro Okuno (8)

qpstudy 2013.07 NoSQL
qpstudy 2013.07 NoSQLqpstudy 2013.07 NoSQL
qpstudy 2013.07 NoSQL
 
カジュアルにソースコードリーディング
カジュアルにソースコードリーディングカジュアルにソースコードリーディング
カジュアルにソースコードリーディング
 
SQLの話
SQLの話SQLの話
SQLの話
 
Write parser with fun!
Write parser with fun!Write parser with fun!
Write parser with fun!
 
groonga with PostgreSQL
groonga with PostgreSQLgroonga with PostgreSQL
groonga with PostgreSQL
 
Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19
 
第一回Mongo dbソースコードリーディング 20110628
第一回Mongo dbソースコードリーディング 20110628第一回Mongo dbソースコードリーディング 20110628
第一回Mongo dbソースコードリーディング 20110628
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger
 

Último

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Mongo db勉強会20110730

  • 1. Not only NoSQL! RDB - PostgreSQL MongoDB 20110730 @choplin
  • 4. Document-oriented http://www.mongodb.org/display/DOCS/Introduction
  • 5. Document-oriented High performance http://www.mongodb.org/display/DOCS/Introduction
  • 6. Document-oriented High performance High availability http://www.mongodb.org/display/DOCS/Introduction
  • 7. Document-oriented High performance High availability Easy scalability http://www.mongodb.org/display/DOCS/Introduction
  • 8. Document-oriented High performance High availability Easy scalability Rich query language http://www.mongodb.org/display/DOCS/Introduction
  • 10. Document-oriented http://www.mongodb.org/display/DOCS/Introduction
  • 11. Document-oriented Documents (objects) map nicely to programming language data types http://www.mongodb.org/display/DOCS/Introduction
  • 12. Document-oriented Documents (objects) map nicely to programming language data types Embedded documents and arrays reduce need for joins http://www.mongodb.org/display/DOCS/Introduction
  • 13. Document-oriented Documents (objects) map nicely to programming language data types Embedded documents and arrays reduce need for joins Dynamically-typed (schemaless) for easy schema evolution http://www.mongodb.org/display/DOCS/Introduction
  • 14. Document-oriented Documents (objects) map nicely to programming language data types Embedded documents and arrays reduce need for joins Dynamically-typed (schemaless) for easy schema evolution No joins and no multi-document transactions for high performance and easy scalability http://www.mongodb.org/display/DOCS/Introduction
  • 16. High performance http://www.mongodb.org/display/DOCS/Introduction
  • 17. High performance No joins and embedding makes reads and writes fast http://www.mongodb.org/display/DOCS/Introduction
  • 18. High performance No joins and embedding makes reads and writes fast Indexes including indexing of keys from embedded documents and arrays http://www.mongodb.org/display/DOCS/Introduction
  • 19. High performance No joins and embedding makes reads and writes fast Indexes including indexing of keys from embedded documents and arrays Optional asynchronous writes http://www.mongodb.org/display/DOCS/Introduction
  • 20. Point No Relation (No Join) No Transaction
  • 21. Point No Relation (No Join) No Transaction Solved many problems!
  • 25. Exapmple Date
  • 26. Exapmple Date Title
  • 27. Exapmple Date Title Tag
  • 28. Exapmple Date Title Tag body
  • 29. No Join! > use blog switched to db blog > db.post.insert({ title: " 4 Sugamo.vim ..." ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." })
  • 30. No Join! > use blog switched to db blog > db.post.insert({ title: " 4 Sugamo.vim ..." It’s embedded!! ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." })
  • 31. Array and Object > db.post.insert({ title: " 4 Sugamo.vim ..." ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." ,comment: [ { name: “vimmer” ,comment: “vim is great!” } ,{}... ] })
  • 32. Array and Object > db.post.insert({ title: " 4 Sugamo.vim ..." Array ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." ,comment: [ { name: “vimmer” ,comment: “vim is great!” } ,{}... ] })
  • 33. Array and Object > db.post.insert({ title: " 4 Sugamo.vim ..." Array ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." ,comment: [ Objects in array { name: “vimmer” ,comment: “vim is great!” } ,{}... ] })
  • 36. Embedded Reduce join Better performance
  • 37. Embedded Reduce join Better performance Join itself (executer)
  • 38. Embedded Reduce join Better performance Join itself (executer) Query plan (optimizer)
  • 39. Embedded Reduce join Better performance Join itself (executer) Query plan (optimizer) Reduce impedance mismatch between db and apps
  • 40. Embedded Reduce join Better performance Join itself (executer) Query plan (optimizer) Reduce impedance mismatch between db and apps Also easy to understand :)
  • 41. Embedded Reduce join Better performance Join itself (executer) Query plan (optimizer) Reduce impedance mismatch between db and apps Also easy to understand :) but, still have to consider a lot ...
  • 42. Things to be considered
  • 43. Things to be considered Document size limitation (16MB)
  • 44. Things to be considered Document size limitation (16MB) Write / Read ratio
  • 45. Things to be considered Document size limitation (16MB) Write / Read ratio Type of query
  • 46. Things to be considered Document size limitation (16MB) Write / Read ratio Type of query In-place update
  • 47. Things to be considered Document size limitation (16MB) Write / Read ratio Type of query In-place update etc.
  • 48. More detail Official : Schema design http://www.mongodb.org/display/DOCS/Schema+Design MongoDB Schema Design - MongoSF 2011 http://speakerdeck.com/u/kbanker/p/mongodb-schema-design- mongosf-2011 MongoDB Schema Design : myNoSQL http://nosql.mypopescu.com/post/907003504/mongodb-schema- design MongoDB Relation http://d.hatena.ne.jp/masa_w/20101130/1291084939
  • 52. Wait!
  • 54. Array blog=# CREATE TABLE post ( id int ,title text ,postDate date ,tag text[] ,body text );
  • 55. Array blog=# CREATE TABLE post ( id int ,title text Array of text ,postDate date ,tag text[] ,body text );
  • 56. Array blog=# INSERT INTO post VALUES ( 1 ,’ 4 Sugamo.vim ...’ ,’2011/7/19’ ,ARRAY[‘ ’, ‘vim’] ,’Sugamo.vim 7/19 ...’ );
  • 57. Array blog=# INSERT INTO post VALUES ( 1 ,’ 4 Sugamo.vim ...’ Array literal ,’2011/7/19’ ,ARRAY[‘ ’, ‘vim’] ,’Sugamo.vim 7/19 ...’ );
  • 58. Array blog=# SELECT tag FROM post tag -------------- { ,vim} (1 row)
  • 61. Difference Dynamically typed { tag : [1, ‘two’, new Date()] }
  • 62. Difference Dynamically typed { tag : [1, ‘two’, new Date()] } Statically typed SELECT ARRAY[1, 2, 3]::int[]
  • 64. Array to string > db.post.findOne({tag:"vim"}).tag.join(',') ,vim
  • 65. Array to string blog=# SELECT array_to_string(tag, ',') FROM post; array_to_string ----------------- ,vim (1 row)
  • 66. String to array > db.post.findOne{tag:"vim"}).body.split(' ') [ "Sugamo.vim", "7/19", "..." ]
  • 67. String to array blog=# SELECT string_to_array(body, ' ') FROM post; string_to_array ---------------------- {Sugamo.vim,7/19,..} (1 row)
  • 68. array to row blog=# SELECT unnest(body, ' ') FROM post; unnest -------- vim (2 rows)
  • 69. row to array blog=# SELECT array_agg(v) FROM ( SELECT unnest(tag, ' ') v FROM post ) t; array_agg -------------- { ,vim} (1 row)
  • 71. Indexing > db.post.ensureIndex({tag:1}); > db.post.find({tag:"vim"}).explain() { "isMultiKey" : true, ! "cursor" : "BtreeCursor ! "indexOnly" : false, tag_1", ! "indexBounds" : { ! "nscanned" : 1, ! ! "tag" : [ ! "nscannedObjects" : 1, ! ! ! [ ! "n" : 1, ! ! ! ! "vim", ! "millis" : 0, ! ! ! ! "vim" ! "nYields" : 0, ! ! ! ] ! "nChunkSkips" : 0, ! ! ] ! ! } } http://www.slideshare.net/matsuou1/20110514-mongo-db
  • 72. Indexing blog=# CREATE INDEX on post USING gin(tag); ※Gin : Generalized Inverted Index
  • 73. Indexing blog=# set enable_seqscan = off; blog=# EXPLAIN SELECT * FROM post WHERE tag @> ARRAY['vim'] QUERY PLAN --------------------------------------------------------------------------- Bitmap Heap Scan on post (cost=4.26..8.27 rows=1 width=104) Recheck Cond: (tag @> '{vim}'::text[]) -> Bitmap Index Scan on post_tag_idx (cost=0.00..4.26 rows=1 width=0) Index Cond: (tag @> '{vim}'::text[]) (4 rows)
  • 75. Inverted Index Data Index T0 = "it is what it is", "a": {2} T1 = "what is it", "banana": {2} T2 = "it is a banana" "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
  • 76. Inverted Index Data Index T0 = "it is what it is", "a": {2} T1 = "what is it", "banana": {2} T2 = "it is a banana" "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} key http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
  • 77. Inverted Index Data Index T0 = "it is what it is", "a": {2} T1 = "what is it", "banana": {2} T2 = "it is a banana" "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} posting list key /bucket http://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE %E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9
  • 79. Inner Structure posting tree key tree /bucket tree
  • 80. Inner Structure posting tree key tree /bucket tree ※ Wanted! More precise info at MongoReading :)
  • 82. Map/Reduce map = function() { if (!this.tags) { return; } for (index in this.tags) { emit(this.tags[index], 1); } } http://cookbook.mongodb.org/patterns/count_tags/
  • 83. Map/Reduce reduce = function(previous, current) { var count = 0; for (index in current) { count += current[index]; } return count; } http://cookbook.mongodb.org/patterns/count_tags/
  • 84. Map/Reduce > result = db.runCommand({ ... "mapreduce" : "posts", ... "map" : map, ... "reduce" : reduce, ... "out" : "tags"}) > db.tags.find() { "_id" : "vim", "value" : 1 } { "_id" : " ", "value" : 1 } http://cookbook.mongodb.org/patterns/count_tags/
  • 85. Group By blog=# SELECT tag, count(tag) FROM ( SELECT unnest(tag, ' ') tag FROM post )t GROUP BY tag; tag | count --------+------- | 1 vim | 1 (2 rows)
  • 87. Object > db.post.insert({ title: " 4 Sugamo.vim ..." ,postDate: new Date(2011, 6, 19) ,tag: [" ", "vim"] ,body: "Sugamo.vim 7/19 ..." ,comment: [ { Object name: “vimmer” ,comment: “vim is great!” } ,{}... ] })
  • 89. contrib/hstore # SELECT ‘a => 1, b => 2’::hstore "a"=>"1", "b"=>"2" Type for group of (key => value) Can be indexed with Gin/GiST Can’t be nested ....
  • 90. XML Type <book> <title> </title> <author> </author> <author> </author> <publisher> </publisher> </book> http://lets.postgresql.jp/documents/tutorial/xml/1/
  • 91. XML Type testdb=# CREATE TABLE t_books(books xml); testdb=# INSERT INTO t_books(books) VALUES(' testdb'# <book> testdb'# <title> </title> testdb'# <author> </author><author> </author> testdb'# <publisher> </publisher> testdb'# </book> testdb'# '); http://lets.postgresql.jp/documents/tutorial/xml/1/
  • 92. XML Type testdb=# SELECT xpath('/book[author/text()=" "/title', books) FROM t_books; xpath --------------------------------------------- {<title> </title>} (1 rows) http://lets.postgresql.jp/documents/tutorial/xml/1/
  • 93. XML Type Access element with xpath() Can be indexed with xpath/Functional Index http://lets.postgresql.jp/documents/tutorial/xml/1/
  • 95. hardly get along with relational model ...
  • 97. The Scripting Language of Databases $m = new Mongo(); $m->test->formResults->insert($_POST); print_r($m->test->formResults->findOne()); http://www.snailinaturtleneck.com/blog/2011/04/06/the-scripting-language-of-databases/
  • 99. My Opinion Use Mongo instead of ORM! (or write SQL directly) ORM 11 http://tech.a-listers.jp/2011/06/16/orm_is_an_antipattern/

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n