05 NoSQL
05 NoSQL
1
Big Data (some old numbers)
• Facebook:
130TB/day: user logs
200-400TB/day: 83 million pictures
Many components:
• Storage systems
• Database systems
• Data mining and statistical algorithms
• Visualization
3
What is NoSQL?
• An emerging “movement” around
non-relational software for Big Data
• Roots are in the Google and Amazon homegrown
software stacks
5
NoSQL features
• Scalability is crucial!
load increased rapidly for many applications
• Large servers are expensive
6
NoSQL features
• Sometimes not a well defined schema
7
Flavors of NoSQL
10
Key-Value Stores
11
Document Databases
Examples include: MongoDB, CouchDB, Terrastore
14
Example mongodb
{ "_id”:ObjectId("4efa8d2b7d284dad101e4bc9"),
"Last Name": ” Cousteau",
"First Name": ” Jacques-Yves",
"Date of Birth": ”06-1-1910" },
{ "_id": ObjectId("4efa8d2b7d284dad101e4bc7"),
"Last Name": "PELLERIN",
"First Name": "Franck",
"Date of Birth": "09-19-1983",
"Address": "1 chemin des Loges",
"City": "VERSAILLES" }
15
Example Document Database:
MongoDB
Key features include:
• JSON-style documents
• actually uses BSON (JSON's binary
format)
• replication for high availability
• auto-sharding for scalability
• document-based queries
• can create an index on any attribute
• for faster reads
16
MongoDB Terminology
relational term <== >MongoDB equivalent
----------------------------------------------------------
database <== > database
table <== > collection
row <== > document
attributes <== > fields (field-name:value pairs)
primary key <== > the _id field, which is the key
associated with the document
17
JSON
• JSON is an alternative data model for
semi-structured data.
• JavaScript Object Notation
20
Capturing Relationships in
MongoDB
• Two options:
1. store references to other documents
using their _id values
21
Example relationships
Consider the following documents examples:
{ {
"_id":ObjectId("52ffc33cd85242f436000001"), "_id":ObjectId("52ffc4a5d85242602e000000"),
"name": "Tom Hanks", "building": "22 A, Indiana Apt",
"contact": "987654321", "pincode": 123456,
"dob": "01-01-1991" "city": "Los Angeles",
} "state": "California"
}
23