SlideShare une entreprise Scribd logo
1  sur  15
Intro to NoSQL databases

Redis & Mongo DB
Overview
➲
●

Redis
What, when, why, how

➲Mongo
●

➲

DB

What, when, why, how

Questions
Redis
➲
●
●
●

What is Redis
Redis is an open-source key-value data store
Primarily an in-memory database
Has the option of persisting data indefinitely

➲Key
●

Data Structures

Strings, lists, sets, hashes, sorted sets
Why Redis
➲Speed
●

– Redis is really fast

Hard to find specific numbers but I've seen claims
that it's up to 5-20 times faster than traditional
databases for certain applications

➲Specialized

– Has highly customized tools
that solves certain problems extremely
well.
➲This contrasts with a traditional RDBMS that
tries to be all things to all people
➲Generally seen as complimentary to a
traditional RDBMS
When To Use Redis
➲You

have to know the best type of data
structure and algorithm for solving the
problem you have
➲Redis publishes the Big-O notation
performance numbers for all it's operations
➲If redis supports that algorithm then you'll
probably want to use redis for it
Big O Review
➲O(1)
●
●

– constant time.

Fastest any algorithm can be
Always takes the same amount of time

➲O(log(n))
●
●

– logarithmic time

2nd fastest time
Uses a divide and conquer

➲O(n) – linear time
➲Others include
●

O(n^2), O(c^n), O(n+m*log(m))
Using Redis
➲set x:y "{id:9000, email: 'test@axum.net'}"
➲get x:y
➲“set” - command
➲x:y – key
➲"{id:9000, email: 'test@axum.net'}" - value
➲By convention keys are of the form:
●

z:y:x

➲But

other values are allowed
Using Redis
➲A

simple application is to use redis to count
page views

●
●

incr stats:page:about
incrby ratings:video:1233 6
Mongo DB
➲MongoDB

has the same concept of a database that you are
familiar with
➲Within a MongoDB instance you can have zero or more
databases, each acting as high-level containers for
everything else.
➲A database can have zero or more collections. A collection
shares enough in common with a traditional table that you
can safely think of the two as the same thing.
➲Collections are made up of zero or more documents. Again,
a document can safely be thought of as a row.
➲
Mongo DB
➲A

document is made up of one or more fields, which you can
probably guess are a lot like columns.
➲Indexes in MongoDB function much like their RDBMS
counterparts.
➲Cursors - when you ask MongoDB for data, it returns a
cursor, which we can do things to, such as counting or
skipping ahead, without actually pulling down data.
Mongo DB
➲If

●

●
●
●

Mongo is so similar to existing DBMS then why
use new terminology (collection vs. table,
document vs. row and field vs. column)?

relational databases define columns at the table level whereas a
document-oriented database defines its fields at the
document level.
Each document within a collection can have its own unique set of
fields.
A collection imposes less strict rules on a container in
comparison to a table
A document usually has a lot more information than a row.
Using Mongo
➲
●
●

➲
●
●

The mongo CLI uses JavaScript syntax
db.help() prints the list of available commands
db.stats() prints the current information about your db

Since Collections do not have schemas we can do
the following:

db.unicorns.insert({name: ’Aurora’, gender: ’f’, weight: 450})
The 'unicorns collection will be created and document with name='Aurora' will be added to
it
Using Mongo
➲
●
●
●

Other Commands
db.unicorns.find() - returns list of documents in the 'unicorns' collection
"_id" : ObjectId("5239aaa9635c8909872a74fa"), "name" : "Aurora", "gender" :
"f", "weight" : 450 }
db.unicorns.find({gender: ’m’, weight: {$gt: 700}})

➲db.stats()
●

➲

prints the current information about your db

db.unicorns.update({name: ’Roodles’}, {weight: 590})
Demo
➲
Questions
➲

Contenu connexe

Tendances

21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...Athens Big Data
 
Updating materialized views and caches using kafka
Updating materialized views and caches using kafkaUpdating materialized views and caches using kafka
Updating materialized views and caches using kafkaZach Cox
 
Introduction to mongo db by zain
Introduction to mongo db by zainIntroduction to mongo db by zain
Introduction to mongo db by zainKenAndTea
 
«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»Olga Lavrentieva
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014Gerd König
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDBCésar Trigo
 
Replicating application data into materialized views
Replicating application data into materialized viewsReplicating application data into materialized views
Replicating application data into materialized viewsZach Cox
 
Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Developmentmssaman
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introductionEdward Yoon
 

Tendances (20)

Mongo db1
Mongo db1Mongo db1
Mongo db1
 
MongoDB
MongoDBMongoDB
MongoDB
 
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
 
Updating materialized views and caches using kafka
Updating materialized views and caches using kafkaUpdating materialized views and caches using kafka
Updating materialized views and caches using kafka
 
Introduction to mongo db by zain
Introduction to mongo db by zainIntroduction to mongo db by zain
Introduction to mongo db by zain
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»
 
Mongo db
Mongo dbMongo db
Mongo db
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
NoSQL
NoSQLNoSQL
NoSQL
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
Replicating application data into materialized views
Replicating application data into materialized viewsReplicating application data into materialized views
Replicating application data into materialized views
 
Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Development
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introduction
 

Similaire à Redis IU

Similaire à Redis IU (20)

Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
 
Mongo db dhruba
Mongo db dhrubaMongo db dhruba
Mongo db dhruba
 
Mongodb
MongodbMongodb
Mongodb
 
Mongo db
Mongo dbMongo db
Mongo db
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptx
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
 
The Little MongoDB Book - Karl Seguin
The Little MongoDB Book - Karl SeguinThe Little MongoDB Book - Karl Seguin
The Little MongoDB Book - Karl Seguin
 
MongoDB
MongoDBMongoDB
MongoDB
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
Mongodb
MongodbMongodb
Mongodb
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
 

Plus de Isaiah Edem

Sleep and Dreams
Sleep and DreamsSleep and Dreams
Sleep and DreamsIsaiah Edem
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceIsaiah Edem
 
Outdated Technology
Outdated TechnologyOutdated Technology
Outdated TechnologyIsaiah Edem
 
Computer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesComputer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesIsaiah Edem
 
Importanc of softwaretesting
Importanc of softwaretestingImportanc of softwaretesting
Importanc of softwaretestingIsaiah Edem
 
Cyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionCyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionIsaiah Edem
 

Plus de Isaiah Edem (8)

Sleep and Dreams
Sleep and DreamsSleep and Dreams
Sleep and Dreams
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Outdated Technology
Outdated TechnologyOutdated Technology
Outdated Technology
 
Green Computing
Green ComputingGreen Computing
Green Computing
 
Computer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesComputer Forensics in Fighting Crimes
Computer Forensics in Fighting Crimes
 
Importanc of softwaretesting
Importanc of softwaretestingImportanc of softwaretesting
Importanc of softwaretesting
 
Cyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionCyber Security & User's Privacy Invasion
Cyber Security & User's Privacy Invasion
 
Fear
FearFear
Fear
 

Dernier

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Redis IU

  • 1. Intro to NoSQL databases Redis & Mongo DB
  • 2. Overview ➲ ● Redis What, when, why, how ➲Mongo ● ➲ DB What, when, why, how Questions
  • 3. Redis ➲ ● ● ● What is Redis Redis is an open-source key-value data store Primarily an in-memory database Has the option of persisting data indefinitely ➲Key ● Data Structures Strings, lists, sets, hashes, sorted sets
  • 4. Why Redis ➲Speed ● – Redis is really fast Hard to find specific numbers but I've seen claims that it's up to 5-20 times faster than traditional databases for certain applications ➲Specialized – Has highly customized tools that solves certain problems extremely well. ➲This contrasts with a traditional RDBMS that tries to be all things to all people ➲Generally seen as complimentary to a traditional RDBMS
  • 5. When To Use Redis ➲You have to know the best type of data structure and algorithm for solving the problem you have ➲Redis publishes the Big-O notation performance numbers for all it's operations ➲If redis supports that algorithm then you'll probably want to use redis for it
  • 6. Big O Review ➲O(1) ● ● – constant time. Fastest any algorithm can be Always takes the same amount of time ➲O(log(n)) ● ● – logarithmic time 2nd fastest time Uses a divide and conquer ➲O(n) – linear time ➲Others include ● O(n^2), O(c^n), O(n+m*log(m))
  • 7. Using Redis ➲set x:y "{id:9000, email: 'test@axum.net'}" ➲get x:y ➲“set” - command ➲x:y – key ➲"{id:9000, email: 'test@axum.net'}" - value ➲By convention keys are of the form: ● z:y:x ➲But other values are allowed
  • 8. Using Redis ➲A simple application is to use redis to count page views ● ● incr stats:page:about incrby ratings:video:1233 6
  • 9. Mongo DB ➲MongoDB has the same concept of a database that you are familiar with ➲Within a MongoDB instance you can have zero or more databases, each acting as high-level containers for everything else. ➲A database can have zero or more collections. A collection shares enough in common with a traditional table that you can safely think of the two as the same thing. ➲Collections are made up of zero or more documents. Again, a document can safely be thought of as a row. ➲
  • 10. Mongo DB ➲A document is made up of one or more fields, which you can probably guess are a lot like columns. ➲Indexes in MongoDB function much like their RDBMS counterparts. ➲Cursors - when you ask MongoDB for data, it returns a cursor, which we can do things to, such as counting or skipping ahead, without actually pulling down data.
  • 11. Mongo DB ➲If ● ● ● ● Mongo is so similar to existing DBMS then why use new terminology (collection vs. table, document vs. row and field vs. column)? relational databases define columns at the table level whereas a document-oriented database defines its fields at the document level. Each document within a collection can have its own unique set of fields. A collection imposes less strict rules on a container in comparison to a table A document usually has a lot more information than a row.
  • 12. Using Mongo ➲ ● ● ➲ ● ● The mongo CLI uses JavaScript syntax db.help() prints the list of available commands db.stats() prints the current information about your db Since Collections do not have schemas we can do the following: db.unicorns.insert({name: ’Aurora’, gender: ’f’, weight: 450}) The 'unicorns collection will be created and document with name='Aurora' will be added to it
  • 13. Using Mongo ➲ ● ● ● Other Commands db.unicorns.find() - returns list of documents in the 'unicorns' collection "_id" : ObjectId("5239aaa9635c8909872a74fa"), "name" : "Aurora", "gender" : "f", "weight" : 450 } db.unicorns.find({gender: ’m’, weight: {$gt: 700}}) ➲db.stats() ● ➲ prints the current information about your db db.unicorns.update({name: ’Roodles’}, {weight: 590})

Notes de l'éditeur

  1. {}