Back to Basics 2017 - Introduction to NoSQL
-
Upload
joe-drumgoole -
Category
Software
-
view
17 -
download
0
Transcript of Back to Basics 2017 - Introduction to NoSQL
Back to Basics 2017 : Webinar 1
Introduction to NoSQLJoe Drumgoole
Director of Developer Advocacy, EMEAMongoDB
@jdrumgoole
V1.3
Welcome!
4
Course Agenda
Date Time Webinar19-Jan-2017 15:00 GMT Introduction to NoSQL26-Jan-2017 15:00 GMT Your First MongoDB Application02-Feb-2017 11:00 GMT Introduction to Replica Sets09-Feb-2017 11:00 GMT Introduction to Sharding
5
Agenda for Today
• Why NoSQL• The different types of NoSQL database• Detailed overview of MongoDB• Q&A
6
Relational
Expressive Query Language& Secondary Indexes
Strong Consistency
Enterprise Management& Integrations
7
The World Has Changed
Data Risk Time Cost
8
NoSQL
Scalability& Performance
Always On,Global Deployments
FlexibilityExpressive Query Language& Secondary Indexes
Strong Consistency
Enterprise Management& Integrations
9
Nexus Architecture
Scalability& Performance
Always On,Global Deployments
FlexibilityExpressive Query Language& Secondary Indexes
Strong Consistency
Enterprise Management& Integrations
10
Types of NoSQL Database
• Key/Value Stores• Column Stores• Graph Stores• Multi-model Databases• Document Stores
11
Key Value Stores
• An associative array• Single key lookup• Very fast single key lookup• Not so hot for “reverse lookups”
Key Value
12345 4567.3456787
12346 { addr1 : “The Grange”, addr2: “Dublin” }
12347 “top secret password”
12358 “Shopping basket value : 24560”
12787 12345
12
Revision : Row Stores (RDBMS)
• Store data aligned by rows (traditional RDBMS, e.g MySQL)• Reads retrieve a complete row everytime• Reads requiring only one or two columns are wasteful
ID Name Salary Start Date
1 Joe D $24000 1/Jun/1970
2 Peter J $28000 1/Feb/1972
3 Phil G $23000 1/Jan/1973
1 Joe D $24000 1/Jun/1970 2 Peter J $28000 1/Feb/1972 3 Phil G $23000 1/Jan/1973
13
How a Column Store Does it
1 2 3
ID Name Salary Start Date
1 Joe D $24000 1/Jun/1970
2 Peter J $28000 1/Feb/1972
3 Phil G $23000 1/Jan/1973
Joe D Peter J Phil G $24000 $28000 $23000 1/Jun/1970 1/Feb/1972 1/Jan/1973
14
Why is this Attractive?
• A series of consecutive seeks can retrieve a column efficiently• Compressing similar data is super efficient• How do I align my rows? By order or by inserting a row ID• IF you just need a small number of columns you don’t need to
read all the rows• But:
– Updating and deleting by row is expensive• Append only is preferred• Better for OLAP than OLTP
15
Graph Stores
• Store graphs (edges and vertexes)• E.g. social networks• Designed to allow efficient traversal• Optimised for representing connections• Can be implemented as a key value stored with the ability to store
links• MongoDB 3.4 supports graph queries
16
Multi-Model Databases
• Combine multiple storage/access models• Often Graph plus “something else”• Fixes the “polyglot persistence” issue of keeping multiple
independent databases consistent• The “new new thing” in NoSQL Land• MongoDB is a "multi-modal" document store
– Graph– Geo-Spatial– B-tree– Full Text
17
Document Store• Not PDFs, Microsoft Word or HTML• Documents are nested structures created using Javascript Object Notation (JSON)
{ name : “Joe Drumgoole”,title : “Director of Developer Advocacy”,Address : {
address1 : “Latin Hall”,address2 : “Golden Lane”,eircode : “D09 N623”,
}expertise: [ “MongoDB”, “Python”, “Javascript” ],employee_number : 320,location : [ 53.34, -6.26 ]
}
18
MongoDB Documents are Typed
{
name : “Joe Drumgoole”,
title : “Director of Developer Advocacy”,
Address : {
address1 : “Latin Hall”,
address2 : “Golden Lane”,
eircode : “D09 N623”,
}
expertise: [ “MongoDB”, “Python”, “Javascript” ],
employee_number : 320,
location : [ 53.34, -6.26 ]
}
Strings
Nested Document
Array
Integer
Geo-spatial Coordinates
19
MongoDB Understands JSON Documents
• From the very first version it was a native JSON database• Understands and can index the sub-structures• Stores JSON as a binary format called BSON• Efficient for encoding and decoding for network transmission• MongoDB can create indexes on any document field• (We will cover these areas in detail later on in the course)
20
Why Documents?• Dynamic Schema• Elimination of Object/Relational Mapping Layer• Implicit denormalisation of the data for performance
21
Why Documents?• Dynamic Schema• Elimination of Object/Relational Mapping Layer• Implicit denormalisation of the data for performance
22
Aggregation Framework
23
Pipeline Operators• $match
Filter documents
• $projectReshape documents
• $groupSummarize documents
• $outCreate new collections
• $sortOrder documents
• $limit/$skipPaginate documents
• $lookupJoin two collections together
• $unwindExpand an array
24
Instant Start with Compass and AtlasCompass
Atlas
25
Next Webinar – Your First MongoDB Application
• 26th Jan 2017 – 15:00 GMT.• Learn how to build your first MongoDB application
– Create databases and collections– Look at queries– Build indexes– Start to understand performance
• Register at https://www.mongodb.com/webinar/back-to-basics-webinar-series
• Send feedback to [email protected]
26
What's Next?
• Sign up for an online course: https://university.mongodb.com/• Join a MUG: https://www.meetup.com/pro/mongodb/
Q&A