• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
vOfficeware Brown Bag - NOSQL
 

vOfficeware Brown Bag - NOSQL

on

  • 642 views

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

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

Statistics

Views

Total Views
642
Views on SlideShare
563
Embed Views
79

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 79

http://www.vofficeware.com 79

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    vOfficeware Brown Bag - NOSQL vOfficeware Brown Bag - NOSQL Presentation Transcript

    • Schema-less Databases By Zack Schwartz Brown Bag Presentations
        • 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
        • 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
        • Documents are essentially associative arrays like:
          • JSON objects
          • PHP arrays 
          • Python dictionaries.
      Flexibility in Documents Brown Bag Presentations Schema-less Databases By Zack Schwartz
    • --- Case Study --- Brown Bag Presentations Schema-less Databases By Zack Schwartz
        • 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
    • MySQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
      • 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
        • 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
    • Another View of NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
        • 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
      • 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
        • 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
        • 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
        • 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
    • 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