NoSQL Flashcards

1
Q

What is NoSQL?

A

NoSQL databases are non-tabular databases and store data differently than relational tables. Basically databases that store data in a format other than relational tables.

  • Non-Relational
  • Mostly JSON files
  • Dynamic Schema
  • Horizontal Scalability
  • No JOINS
  • Not recommended for OLTP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the CAP and Brewer Theorem?

A

CAP Theorem states that within a large-scale data system, there are three requirements that have a relationship of sliding dependency.

  • Consistency: All clients will read the same value for the same query
  • Availability: All clients will always be able to read and write data
  • Partition Tolerance: The database can be split into multiple machines.

Brewer’s theorem says that you can strongly support only two of the three.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some NoSQL databases and which requirements do they apply to, for the CAP theorem?

A

Availability & Partition Tolerance

  • Dynamo
  • Cassandra

Availability & Consistency
- RDBMS (MySQL, PostgressDB)

Consistency & Partition Tolerance

  • BigTable
  • MongoDB
  • Redis
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

NoSQL DB Types

A

Document Databases (MongoDB): Designed for storing, retrieving and managing semi-structured data.
Column Based Databases (BigTable, HBase): Stores data tables as columns rather than rows.
Key/Value Databases (Dynamo, Redis): Similar to a dictionary or a hash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the advantages of NoSQL over traditional RDBMS?

A

It supports semi-structured data and it does not enforce a schema.
Read/Write throughput is very high and horizontal scalability can be achieved easily.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define ACID properties

A

Atomicity: It ensures that either all operations succeed or fall together.
Consistency: It ensures that changes made within a transaction are consistent with database constraints.
Isolation: It ensures that concurrent transactions do not affect each other’s outcomes.
Durability: Data is not lost even at the time of server failure

These ACID properties ensure that a set of database operations (grouped together in a transaction) leave the database in a valid state even in the event of unexpected errors.

For reference and a nice explanation: https://www.mongodb.com/basics/acid-transactions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Is MongoDB ACID-compliant?

A

It has always been compliant at the document level. Not until 2018 has it started allowing multiple-document updates (transactions).

Remember that transactions allows you to group a set of database read and write operations so that it only succeeds if all the operations within succeed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between Document-Oriented and Key-Value in NoSQL Databases?

A

A key-value store provides the simplest possible data model. It’s a storage system that stores values indexed by a key.This allows very fast read and write operations.

A document-oriented extends the previous model and values are stored in a structured format (document) but still uses key/value pairs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between Column-oriented vs Document-oriented NoSQL databases?

A

The main difference is how the data is physically stored. With column-types, data is stored by columns which can enable efficient aggregation operations / queries on a particular columns. With document-types, the entire document is logically stored in one place and it is generally retrieved as a whole (no efficient aggregation possible on columns/fields)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are Indexes in MongoDB?

A

They support the efficient execution of queries. Without them, MondoDB must perform a collection scan (scan every document in a collection, to select those documents that match the query statement. With an index, MongoDB can limit the number of documents it must inspect.

They are special data structures that store a small portion of the collection’s data set in an easy to traverse form.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly