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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

vOfficeware Brown Bag - NOSQL

469

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
469
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. <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. <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. <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. --- Case Study --- Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 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. MySQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 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. <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. Another View of NoSQL Brown Bag Presentations Schema-less Databases By Zack Schwartz
  • 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. <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. <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. <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. <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. 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

×