What’s a relational DB
hint - what does it say about its data (2 bullet points)
What are 4 important aspects of a relational DB
What’s ACID compliance (what does ACID stands for)
What’s data integrity (referring to one aspect of a relational DB, 4 bullet points)
Data integrity
- overall completeness, accuracy and consistency of data - use a set of constraints to enforce data integrity - These include primary Keys, Foreign Keys, ‘Not NULL’ constraint, ‘Unique’ constraint, ‘Default’ constraint and ‘Check’ constraints - most relation databases also allow custom code to be embedded in triggers that execute based on an action on the database
Name a few popular relational DB (no need to name all)
Explain the “A” in ACID
Atomicity - a transaction is either all or nothing
All parts of a transaction are executed completely and successfully, or else the entire transaction fails.
Explain the “C” in ACID
Consistency
Explain the “I” in ACID
Isolation
Explain the “D” in ACID
Durability
- All changes made in the transaction are permanently stored even if the DB fails
Why is DynamoDB noSQL
DynamoDB is NoSQL in that it does not support SQL. Instead, it uses a proprietary API based on JSON.
What’s a noSQL DB
Give some examples of data that are better to be stored in noSQL DB
Loosely defined data like
- email
- videos
- images
- business documents
What are several ways to create noSQL DB
hint - what are some ways other than “key value pairs” (4 bullets including key/value)
Name some common noSQL DB
MongoDB
IBM Cloundant
Amazon DynamoDB
Apache Cassandra
When to use SQL vs noSQL DB
Advantages of using DDB (7 bullets)
Optimistic vs pessimistic locking - How do they lock
Optimistic locking
When you read a record, take note of a version number (other methods to do this involve dates, timestamps or checksums/hashes) and check that the version hasn’t changed before you write the record back.
Pessimistic locking
Lock the record for your exclusive use until you have finished with it.
What fields we can do optimistic locking on
Normally use the version field, but can use other fields such as timestamp, checksum, etc
Pros and cons for pessimistic locking
When do we use optimistic locking
Used in three-tiered architectures where application does not maintain DB locks as connections are taken from a pool.
When do we use pessimistic locking
Either need a direct connection to DB or or an externally available transaction ID that can be used independently of the connection.