NO SQL for SQL DBA Dilip Nayak & Dan Hess
Dilip Nayak Works as Senior DBA at a financial company Email: d_nayak@hotmail.com Twitter: @d_nayak Event Coordinator of Sacramento SQL User Group.
Dan Hess Senior DBA with Corelogic Email: sqldch@expressnetsolutions.com Twitter: @sqldch Bachelor of Science, Computer Science
My Story
How Big is BIGDATA? Source: www.alphr.com
SQL or NoSQL
Limitations of Traditional DBs Scalability Scaling up is very expensive Schema bound Schema is not flexible and fixed. Same/similar type of data Heterogeneous data storage is not possible or recommended.
Benefits of NoSQL Database Schema less Easier for developers Horizontal scalability – lowers cost. Heterogeneous data storage High Availability/Disaster Recovery
SQL vs NoSQL SQL NoSQL Gigabytes to Terabytes Petabytes(1kTB) to Exabytes(1kPB) to Zetabytes(1kEB) Centralized Distributed Structured Semi structured and Unstructured Structured Query Language No declarative query language Stable Data Model Schema less Complex Relationships Less complex relationships ACID Property Eventual Consistency Transaction is priority High Availability, High Scalability Joins Tables Embedded structures
RDBMS vs NoSQL RDBMS No SQL Structured & Organized data Structured Query Language Data and its relationships are stored in different tables. ACID Property Tight consistency Prioritize Transaction is very important. No SQL No predefined Schema No declarative query language. Key-value pair, documents, graph databases Eventual consistency. Unstructured and unpredictable data. Prioritize High Performance, High Availability and High scalability CAP Theorem(Consistency, Availability, Performance)
CAP Theorem
Types of NoSQL Storage
Types of NoSQL Databases http://wikibon.org/w/images/0/08/Disruptive_NoSQL_Database_Solutions.jpg
Types of NoSQL Databases
NoSQL vs SQL http://2.bp.blogspot.com/
MongoDB One of the widely used NoSQL databases Document store database JSON document for operations in DML Data is stored in BSON format. Available in Community, Enterprise Edition.
Data stored in documents
SQL to MongoDB Mapping Chart Database Table Row Column Index Table Joins Primary Key Database Collection Document Field Index Embedded docs Primary Key automatically set to _id field. http://www.mongodb.com
MongoDB architecture Copies of the data on each node Data safety High availability Disaster recovery Maintenance Read scaling
MongoDB architecture “Partitions” of the data Horizontal scale Big data sets
MongoDB architecture Replica set + sharding
DEMO
MongoDB explain plan 3 ways to generate explain plan db.<collection>.explain cursor.explain explain() 3 outputs in explain plan queryPlanner executionStats serverInfo
MongoDB index B+ tree Used to access data quickly Used in sorting, order can matter
Disadvantages of NoSQL No standardization Limited query capability Items are aggregated together like a big excel file Prone to data duplication
No SQL = Not Only SQL
MongoDB GUIs MongoChef Mongo Compass http://3t.io/mongochef/download/ Mongo Compass https://www.mongodb.com/products/compass MongoBooster http://mongobooster.com/
Credits & References http://www.mongodb.com http://university.mongodb.com