SlideShare ist ein Scribd-Unternehmen logo
1 von 27
NOSQL
agile data storage
SQL: THE BEGINNING
• Data structured on tables
 using columns

• Data on one column is the
 key for making relationships
 with other tables

• Normalization

• RDBMS
SQL EXAMPLES
RDBMS BENEFITS
• Normalization  (a common
 standard format for
 accessing data)

• Data   consistency

• Persistence

• Consistency

• Replication
RDBMS PROBLEMS
RDBMS PROBLEMS
• Highcost on performing
 complex operations over a
 big database

• High
     system load: scalability
 needs

• Difficult   failover recovery

• Difficult   denormalization
NOSQL TO THE RESCUE!
NOSQL IS...
•A  storage system for format
 free data

• Web   scale

• Software    darwinism

• Different
          types of solutions
 depending on the needs:
 Key-value, Documents,
 Graphs, Objects...
REDIS
• http://redis.io               Redis is SEXY

• Key-value    store

• In   memory

• Persistent
          (periodical
 asynchronous writes to disk)

• All   operations are atomic
REDIS
Types of data          Cool operations
• Hashes
                       • RPOPLPUSH
• Sets    (arrays)
                       • Pub/Sub
• Lists
REDIS
HSET myuser “email” “ivan@ivanhq.net”
HSET myuser “web” “http://ibelmonte.com”
HSET myuser “blog” “http://ivanh.net”

HGET myuser “email”
- ivan@ivanhq.net
REDIS
sadd myuser:books “jackass”
sadd myuser:books “jackass2”
sadd myuser:books “Dude, where’s my car?”
sadd myuser:books “The hangover”

smembers myuser:books
1. jackass
2. jackass2
3. Dude, where’s my car?
4. The hangover
REDIS

rpush friends “John Doe”
rpush friends “Foo”
rpush friends “Bar”

lrange friends 0 -1
1. John Doe
2. Foo
3. Bar
REDIS

rpush nonfriends “Peter Pan”
rpush nonfriends “Batman”
rpush nonfriends “Betty Boop”

lrange nonfriends 0 -1
1. Peter Pan
2. Batman
3. Betty Boop
REDIS
rpoplpush nonfriends friends

lrange friends 0 -1
1. John Doe
2. Foo
3. Bar
4. Betty Boop

lrange nonfriends 0 -1
1. Peter Pan
2. Batman
REDIS
Pub/Sub.... a freaking AWESOME messaging queue
REDIS

Pro’s:
- Highly performant
- Highly scalable
- Interfaces available for many languages (Ruby: Ohm)

Cons:
- Eats your server’s memory
- Manually sharding
MONGODB
• http://mongodb.org

• Document      store

• Writes   to disk

• Hight   scalability

• Easy   sharding
MONGODB

• Organizes    data using
 collections

• Stores documents in BSON
 format, a binary-encoded
 serialization of JSON
MONGODB

use users
u = { name: “ivan”, company: “Sysdivision”, age: “32” }
users.insert(u)

users.find();
- { "_id" : ObjectId("4d5ea4e79faeda067681e214"),
"name" : "ivan", company: “Sysdivision”, "age" : "32" }
MONGODB
use users
u = { name: “ivan”, company: “Sysdivision”, age: “32” }
users.insert(u)

db.users.find({name: “ivan”});
- { "_id" : ObjectId("4d5ea4e79faeda067681e214"),
"name" : "ivan", company: “Sysdivision”, "age" : "32" }

db.users.find();
db.users.find().skip(20).limit(10);
MONGOID
class User
  include Mongoid::Document
  field :name
  field :birthday, :type => date
  field :money, :type => float, :default => 0.0
  embedded_in :company
end
class Company
  field :name
  embeds_one :user
end
MONGOID
company = Company.create(:name => ‘Sysdivision’)

company.create_user(
                        :name => ‘John Doe’,
                        :birthday => ’12/7/1982’,
                        : money => 0
                       )

User.find(:name => ‘John Doe’)
User.where(:name => /.*ohn.*/)
MONGOID
User.any_of(
              { :name => ‘John Doe’ },
              { :money.gt 10 }
             )

User.any_in(:name => [‘John’, ‘Foo’, ‘Bar’])

User.where(:name => ‘John Doe’).and(:money.gt 10)

Post.all_in(:tags => [‘ruby’, ‘code’, ‘mongo’])
MONGODB

Pro’s:
- Highly performant
- Highly scalable
- Easy sharding
- Ultra powerful querying
- Interfaces available for many languages (Ruby:
mongo_mapper, mongoid)
NOSQL AWESOMENESS
QUESTIONS?




        Ivan Belmonte
        http://ibelmonte.com
        ivan@ivanhq.net

Weitere ähnliche Inhalte

Andere mochten auch

Remote monitoring system
Remote monitoring systemRemote monitoring system
Remote monitoring systemPk Doctors
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web PageWilliam Lee
 
Video Streaming
Video StreamingVideo Streaming
Video StreamingVideoguy
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesVIA Embedded
 
FFMPEG on android
FFMPEG on androidFFMPEG on android
FFMPEG on androidYoss Cohen
 
Streaming Media Server Setup Manual
Streaming Media Server Setup ManualStreaming Media Server Setup Manual
Streaming Media Server Setup ManualWilliam Lee
 
Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Nehil Jain
 
Operational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingOperational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingMary Adel
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on AndroidJomar Tigcal
 
Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.iCreateWorld
 
Internet of things for Smart Home
Internet of things for Smart Home Internet of things for Smart Home
Internet of things for Smart Home Khwaja Aamer
 
Smart Home technologies
Smart Home technologiesSmart Home technologies
Smart Home technologiesloggcity
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Androidyashonil
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Reportstalin george
 

Andere mochten auch (17)

Remote monitoring system
Remote monitoring systemRemote monitoring system
Remote monitoring system
 
FFMPEG TOOLS
FFMPEG TOOLSFFMPEG TOOLS
FFMPEG TOOLS
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web Page
 
Video Streaming
Video StreamingVideo Streaming
Video Streaming
 
Remote Management of Embedded Android Devices
Remote Management of Embedded Android DevicesRemote Management of Embedded Android Devices
Remote Management of Embedded Android Devices
 
FFMPEG on android
FFMPEG on androidFFMPEG on android
FFMPEG on android
 
Streaming Media Server Setup Manual
Streaming Media Server Setup ManualStreaming Media Server Setup Manual
Streaming Media Server Setup Manual
 
Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]Lecture Slides for Location based Services [Android]
Lecture Slides for Location based Services [Android]
 
Rtsp
RtspRtsp
Rtsp
 
Operational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote SensingOperational Agriculture Monitoring System Using Remote Sensing
Operational Agriculture Monitoring System Using Remote Sensing
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
 
Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.Location Tracking of Android Device Based on SMS.
Location Tracking of Android Device Based on SMS.
 
Internet of things for Smart Home
Internet of things for Smart Home Internet of things for Smart Home
Internet of things for Smart Home
 
Smart Home technologies
Smart Home technologiesSmart Home technologies
Smart Home technologies
 
Smart homes
Smart homesSmart homes
Smart homes
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Android
 
Android College Application Project Report
Android College Application Project ReportAndroid College Application Project Report
Android College Application Project Report
 

Ähnlich wie Nosql redis-mongo

MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewAntonio Pintus
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsKorea Sdec
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015Himanshu Desai
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Justin Carmony
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchWynn Netherland
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Ontico
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCupWebGeek Philippines
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
MongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsMongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsSteven Francia
 
NOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the CloudNOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the Cloudboorad
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyNETWAYS
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 

Ähnlich wie Nosql redis-mongo (20)

MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and models
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouch
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
MongoDB, E-commerce and Transactions
MongoDB, E-commerce and TransactionsMongoDB, E-commerce and Transactions
MongoDB, E-commerce and Transactions
 
Mongodb my
Mongodb myMongodb my
Mongodb my
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Practical Use of a NoSQL
Practical Use of a NoSQLPractical Use of a NoSQL
Practical Use of a NoSQL
 
Hadoop - Introduction to Hadoop
Hadoop - Introduction to HadoopHadoop - Introduction to Hadoop
Hadoop - Introduction to Hadoop
 
NOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the CloudNOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the Cloud
 
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross LawleyOSDC 2012 | Building a first application on MongoDB by Ross Lawley
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 

Kürzlich hochgeladen

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Kürzlich hochgeladen (20)

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

Nosql redis-mongo

  • 2. SQL: THE BEGINNING • Data structured on tables using columns • Data on one column is the key for making relationships with other tables • Normalization • RDBMS
  • 4. RDBMS BENEFITS • Normalization (a common standard format for accessing data) • Data consistency • Persistence • Consistency • Replication
  • 6. RDBMS PROBLEMS • Highcost on performing complex operations over a big database • High system load: scalability needs • Difficult failover recovery • Difficult denormalization
  • 7. NOSQL TO THE RESCUE!
  • 8. NOSQL IS... •A storage system for format free data • Web scale • Software darwinism • Different types of solutions depending on the needs: Key-value, Documents, Graphs, Objects...
  • 9. REDIS • http://redis.io Redis is SEXY • Key-value store • In memory • Persistent (periodical asynchronous writes to disk) • All operations are atomic
  • 10. REDIS Types of data Cool operations • Hashes • RPOPLPUSH • Sets (arrays) • Pub/Sub • Lists
  • 11. REDIS HSET myuser “email” “ivan@ivanhq.net” HSET myuser “web” “http://ibelmonte.com” HSET myuser “blog” “http://ivanh.net” HGET myuser “email” - ivan@ivanhq.net
  • 12. REDIS sadd myuser:books “jackass” sadd myuser:books “jackass2” sadd myuser:books “Dude, where’s my car?” sadd myuser:books “The hangover” smembers myuser:books 1. jackass 2. jackass2 3. Dude, where’s my car? 4. The hangover
  • 13. REDIS rpush friends “John Doe” rpush friends “Foo” rpush friends “Bar” lrange friends 0 -1 1. John Doe 2. Foo 3. Bar
  • 14. REDIS rpush nonfriends “Peter Pan” rpush nonfriends “Batman” rpush nonfriends “Betty Boop” lrange nonfriends 0 -1 1. Peter Pan 2. Batman 3. Betty Boop
  • 15. REDIS rpoplpush nonfriends friends lrange friends 0 -1 1. John Doe 2. Foo 3. Bar 4. Betty Boop lrange nonfriends 0 -1 1. Peter Pan 2. Batman
  • 16. REDIS Pub/Sub.... a freaking AWESOME messaging queue
  • 17. REDIS Pro’s: - Highly performant - Highly scalable - Interfaces available for many languages (Ruby: Ohm) Cons: - Eats your server’s memory - Manually sharding
  • 18. MONGODB • http://mongodb.org • Document store • Writes to disk • Hight scalability • Easy sharding
  • 19. MONGODB • Organizes data using collections • Stores documents in BSON format, a binary-encoded serialization of JSON
  • 20. MONGODB use users u = { name: “ivan”, company: “Sysdivision”, age: “32” } users.insert(u) users.find(); - { "_id" : ObjectId("4d5ea4e79faeda067681e214"), "name" : "ivan", company: “Sysdivision”, "age" : "32" }
  • 21. MONGODB use users u = { name: “ivan”, company: “Sysdivision”, age: “32” } users.insert(u) db.users.find({name: “ivan”}); - { "_id" : ObjectId("4d5ea4e79faeda067681e214"), "name" : "ivan", company: “Sysdivision”, "age" : "32" } db.users.find(); db.users.find().skip(20).limit(10);
  • 22. MONGOID class User include Mongoid::Document field :name field :birthday, :type => date field :money, :type => float, :default => 0.0 embedded_in :company end class Company field :name embeds_one :user end
  • 23. MONGOID company = Company.create(:name => ‘Sysdivision’) company.create_user( :name => ‘John Doe’, :birthday => ’12/7/1982’, : money => 0 ) User.find(:name => ‘John Doe’) User.where(:name => /.*ohn.*/)
  • 24. MONGOID User.any_of( { :name => ‘John Doe’ }, { :money.gt 10 } ) User.any_in(:name => [‘John’, ‘Foo’, ‘Bar’]) User.where(:name => ‘John Doe’).and(:money.gt 10) Post.all_in(:tags => [‘ruby’, ‘code’, ‘mongo’])
  • 25. MONGODB Pro’s: - Highly performant - Highly scalable - Easy sharding - Ultra powerful querying - Interfaces available for many languages (Ruby: mongo_mapper, mongoid)
  • 27. QUESTIONS? Ivan Belmonte http://ibelmonte.com ivan@ivanhq.net

Hinweis der Redaktion

  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