SQL vs NoSql Flashcards
What are the primary types of NoSQL dbs?
- Key value stores
- Document databases
- Wide-Columnar Databases
- Graph databases
What is an example of a NoSQL key-value store?
Dynamo & Redis
What is an example of a NoSQL Document DB?
MongoDB
What is an example of a NoSQL Wide Columnar DB?
Cassandra & HBase
What are use cases for a wide columnar database?
Log data
IoT (Internet of Things) sensor data
Time-series data, such as temperature monitoring or financial trading data
Attribute-based data, such as user preferences or equipment features
Real-time analytics
What is the difference between a row based DB vs a column based DB?
Columns are stored together on disk vs rows
What are columnar databases good for?
Columnar databases are great for data analytics. They scan fewer rows and process less data than row-oriented databases.
Because only the necessary columns are read from storage, I/O costs and time are minimized, providing an edge over traditional row-based databases in analytics scenarios.
What is an example of a NoSQL graph database and what’s a good use case?
Neo4J, movie recommendations
What is the difference in scalability between NoSQL vs SQL dbs?
SQL dbs are vertically scaleable, but horizontally scaling is very challenging. NoSQL dbs are horizontally scalable.
What is the different in data integreity guarantees between NoSQL and SQL?
Reliability or ACID Compliancy (Atomicity, Consistency, Isolation, Durability): The vast majority of relational databases are ACID compliant. So, when it comes to data reliability and safe guarantee of performing transactions, SQL databases are still the better bet.
Most of the NoSQL solutions sacrifice ACID compliance for performance and scalability.
What is atomicity?
Atomicity guarantees that each transaction is treated as a single “unit”, which either succeeds completely or fails completely
What is consistency?
Consistency ensures that a transaction can only bring the database from one consistent state to another, preserving database invariants:
What is isolation?
Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially
What is durability?
Durability guarantees that once a transaction has been committed, it will remain committed even in the case of a system failure (e.g., power outage or crash)
Why use a relational DB?
We need to ensure ACID compliance and data is structured and unchanging (scaling not needed).
Why choose NoSQL db?
Storing large volumes of data that often have little to no structure.
Making the most of cloud computing and storage. Cloud-based storage is an excellent cost-saving solution but requires data to be easily spread across multiple servers to scale up.
Rapid development. NoSQL is extremely useful for rapid development as it doesn’t need to be prepped ahead of time