Your SlideShare is downloading. ×
vOfficeware Brown Bag - NOSQL
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

vOfficeware Brown Bag - NOSQL

443
views

Published on

This is a presentation on NOSQL databases and a case study.

This is a presentation on NOSQL databases and a case study.

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
443
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Schema-less Databases By Zack Schwartz Brown Bag Presentations
  • 2.
      • A system of tables and fields.
      • Each table is a collection of specific information.
        • Users, Events, etc
      • The design of how all these tables relate to each other is known as a schema  
    Traditional Databases Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 3.
      • There is no schema.
      • Information is contained in a set of  documents.
      • Each document has a primary key.
      • No enforcement or restrictions of what can be in any document.
      • MongoDB, CouchDB, and Cassandra are types of NoSQL databases.
    Schema-less Databases Brown Bag Presentations
      • Primary Key : 1
      • First Name : John
      • Last Name : Smith
      • Twitter Act : johnsmith
      • Primary Key : 2
      • First Name : Jane
      • Last Name : Doe
      • Email : [email_address]
      • Twitter Act : janedoe
      • Primary Key : 3
      • Email : [email_address]
      • Favorite Food: Cheeseburgers
    Schema-less Databases By Zack Schwartz
  • 4.
      • Documents are essentially associative arrays like:
        • JSON objects
        • PHP arrays 
        • Python dictionaries.
    Flexibility in Documents Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 5. --- Case Study --- Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 6.
      • Engineer an advertising campaign management system
      • Automatically send a tweet if it matches a campaign's rule set.
      • System requires:
        • Multiple Campaigns
          • Multiple Date Ranges in a campaign
            • Days of the week in a date range
            • Multiple times of day to run campaign in date range
            •   Multiple rules per time of day
            • Multiple locations per rule.
      • By the way, code all of this in PHP.
    Ad Campaign Management System Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 7. MySQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 8.
    • SELECT campaign_id WHERE
    •     $date in (SELECT date_id, begin_date, end_date WHERE 
    •                  camp_id = campaign_id AND 
    •                  $time in (SELECT t_id, begin_time, end_time WHERE
    •                                 d_id = date_id AND
    •                                 $rule = (SELECT rule_id, words)...
    • ....
    •                         ....and so on..
    • ....
      • Way too complex.
      • At least five table joins = extremely slow.
    •                         
    Select this Scheme Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 9.
      • MongoDB as an example
        • Everything in one document / associative array.
      •   [Campaign ID]
        • Dates->
          • [0]
            • [begin_date]
            • [end_date]
            • Times->
            • [0]
            • [begin_time]
            • [end_time]
            • Rules->
            • ...
          • [1]....
    Using a NoSQL Solution Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 10. Another View of NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 11.
      • The data structure maps one to one to the database.
      • Wrote script to convert each associative array into objects.
      • Update a location
        • $campaign->$date[0]->$time[1]->$rule[4]->$location[0] = "New York"
      • Update a time
        • $campaign->$date[1]->$time[0].begin_time = "800"
    Ad Campaign Management System Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 12.
    • db.users.find({last_name: 'Smith'}, {'ssn': 1});db.users.find().skip(20).limit(10);db.users.find().sort({last_name: 1});db.collection.find({ "field" :{$in : array}});db.foo.find({x : {$lt : 5}})db.things.insert({colors : [ "yellow" , "orange" ]})db.students.find({'address.state' : 'CA'}).count();
    Example Queries with MongoDB Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 13.
      • Some problems are easier to solve conceptually
      • Faster on reads, slower on reads. 
      • Handles  big data  exceptionally well
        • Metatext project had over 300 million tweets by the end
        • Ad Campaign system had 10 billion tweets.
      • All the standard features you'd expect
      • Nifty features depending on driver used, can store and create objects on the fly.
          • date -> datetime.datetime(2011, 6, 8)
            • Stores object declaration directly in document
            • On query, provides object.
    Advantages to NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 14.
      • Relatively new, less support, community out there
      • Currently there is no framework that integrates the MVC model with NoSQL
        • There is research on this.
      • Does not respond to SQL queries--therefore cannot be used with SQL based reporting tools
      • Might be too flexible for some cases
        • No foreign key restriction 
    Disadvantages to NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 15.
      • NoSQL is great for high volume, high performance, big data solutions.
        • Scales 'horizontally'
        • Works great in the Cloud
          • NetFlix uses multiple NoSQL databases.
      • Sometimes easier to understand/program conceptually
        • Convenient to program forums with Inception-like reply feature (Reddit)
          • Reddit uses Cassandra.
        • Ad Campaign Management system
      • Implementations in most major programming languages including C#.
    Conclusion Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 16. Thank You [email_address] 1629 K St NW, STE 300, Washington, DC 20006 Phone (202) 478-9620 Fax (888) 647-6110 web: www.vofficeware.com