Types of NoSQL databases
• Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents. MongoDB and CouchDB are two popular document databases.
• Graph stores are used to store information about networks, such as social connections. Graph stores include Neo4J and HyperGraphDB.
• Key-value stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or "key"), together with its value. Examples of key-value stores are Redis, Riak and Voldemort.
• Wide-column stores such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.
• 19 tables in the main database
• 44 relationships between tables
• ~3 tables per query
• Results: • 300+ Seconds Loading 1000 Messages
• 31 Queries to Load Home Page
• ~2.43s Response Time
• .78-.88 Database Load
• 8 Minute Unit Tests (“create the universe” for a single test)
{ "_id":"50b3f12fa3bbccf2b4000440", "ancestry":null, "ancestry_depth":0, "created_at":"2012-11-26T22:46:07Z", "flags":["notjunk", "seen"], "full_html_part":null, "full_text_part":null, "html_part":"...", "labels":[...], "mailbox_id":"50b3f0d9a3bbcc6091000005", “message_id”:”[email protected]", "participants":[...], "raw":"...", "timestamp":"2012-11-26T22:41:21+00:00", "uid":7694, "updated_at":"2012-11-27T00:40:57Z" }
Why MongoDB? • JSON (BSON)
• Fast Dumps
• No Serialization
• Iterative
• No Migrations
• Document Orientated
• Natural Fit
• 6 collections
• 4 relationships between collections
• 1 collection per query
• Results: • ~8 Seconds Loading 1000 Messages (~40 Seconds w/ Attachments)
• 2 Queries to Load Home Page
• ~0.81s Response Time
• .13-.17 Database Load
• 11 Second Unit Tests