11. So which type of NoSQL? CAP…
CA = SQL/RDBMS
CP = noSQL/column
SQL Sever / SQL
Hadoop
Azure
Big Table
Oracle
H-base
MySQL
MemCacheDB
(graph)? Consistency
Availability
AP = noSQL/document
or key/value
Partition MongoDB
DynamoDB
Tolerance CouchDB
Cassandra
Voldemort
12. DB Features for MongoDB & SQL Server
Large object primary keys
support and indexes
aggregations queries with
like models for
SUM(), COUNT sorting /
(), etc… limiting results
a strong
typing system
13. DB Features unique to Document DBs
Collections, not Tables
Query language, not T-SQL
Idrefs, not Joins
No pre-defined Schema
Aggregations
• Aggregation Framework
• Grouping or MapReduce
No Transactions
• No multi-document transactions
No Full-text search
15. DB Features of note in MongoDB
• BSON supports more complex types (date, geo-spatial, etc…)
• Supports dynamic queries via proprietary query language
– Uses “find()” which returns a *lazy+ cursor
– Multi-key indexes can be created
• Scalability via Replication and Sharding
16. Why use MongoDB?
Data Structure
• Document-like
• Semi-structured
• Few Joins
• Geospatial
Data Volume
• Large or Huge
• Distributed
• Unpredictable
17. MongoDB Scenarios
Document E-commerce
Archiving /
Management (catalog portion
event logging
systems only)
Real time
analytics (based Gaming Geospatial
on logging)
Mobile
23. Modeling
Use GridFS for
BLOBs
Keep collections
small
Use short names • Can create non-
default (narrower) key
• each name is saved for
• Document size
each document
maximum is 4 MB
• can save up to 30%
storage
32. What about Joins?
Can use
Arrays
No
Can De-
normalize
traditional Can use
Embedded
schema joins in Documents
MongoDB
Can use
DBRef
33. About the Aggregation Framework
• New in MongoDB 2.2
• Layer on top to facilitate easier query-writing
34. Query Tuning
• Use best indexes
– Evaluate use of _id
– Add columns to index (specificity)
– Multiple columns, most specific first
– Can use fully covered indexing (indexOnly:true)
– Test to make sure indexes are being used
• Qty scanned s/b same as QTY returned
• Use .explain
37. Modifying Data
Update Update w/ $set Update w/ $inc
• alone does a replace • does an update • increments
Upserts Multiple field
• must be enabled updates
• then insert if • occur by default
new, update if existing
46. Toward Data Craftsmanship…
Follow me @LynnLangit
RSS my blog
www.LynnLangit.com
Hire me
• To help build your BI/Big Data solution
• To teach your team next gen BI
• To learn more about using NoSQL
solutions