0
Schema-less Databases By Zack Schwartz Brown Bag Presentations
<ul><ul><li>A system of tables and fields. </li></ul></ul><ul><ul><li>Each table is a collection of specific information. ...
<ul><ul><li>There is no schema. </li></ul></ul><ul><ul><li>Information is contained in a set of  documents. </li></ul></ul...
<ul><ul><li>Documents are essentially associative arrays like: </li></ul></ul><ul><ul><ul><li>JSON objects </li></ul></ul>...
--- Case Study --- Brown Bag Presentations Schema-less Databases By Zack Schwartz
<ul><ul><li>Engineer an advertising campaign management system </li></ul></ul><ul><ul><li>Automatically send a tweet if it...
MySQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
<ul><li>SELECT campaign_id WHERE </li></ul><ul><li>     $date in (SELECT date_id, begin_date, end_date WHERE  </li></ul><u...
<ul><ul><li>MongoDB as an example </li></ul></ul><ul><ul><ul><li>Everything in one document / associative array. </li></ul...
Another View of NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
<ul><ul><li>The data structure maps one to one to the database. </li></ul></ul><ul><ul><li>Wrote script to convert each as...
<ul><li>db.users.find({last_name: 'Smith'}, {'ssn': 1});db.users.find().skip(20).limit(10);db.users.find().sort({last_name...
<ul><ul><li>Some problems are easier to solve conceptually </li></ul></ul><ul><ul><li>Faster on reads, slower on reads.  <...
<ul><ul><li>Relatively new, less support, community out there </li></ul></ul><ul><ul><li>Currently there is no framework t...
<ul><ul><li>NoSQL is great for high volume, high performance, big data solutions. </li></ul></ul><ul><ul><ul><li>Scales 'h...
Thank You [email_address] 1629 K St NW, STE 300, Washington, DC 20006 Phone (202) 478-9620 Fax (888) 647-6110 web:  www.vo...
Upcoming SlideShare
Loading in...5
×

vOfficeware Brown Bag - NOSQL

477

Published on

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
477
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "vOfficeware Brown Bag - NOSQL"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×