Databases Flashcards
What are snapshots?
An automated copy of the data in a database is made at regular intervals (every hour). A challenge however is that when snapshots are being taken, the data will be slow. Also, you will lose data that was created after the last snapshot,
What are transaction logs?
Transaction logs are used to record the fact that a transaction is set to occur as well as the information needed by the database server to recover the data back to a consistent state.
What is a standby?
A standby database is where you have another database with synchronous replication and a snapshot is taken from that DB. This is the first scenario where your database does not go down if the data center crashes as you can switch to the standby DB.
How can you increase availability?
Have multiple standbys in multiple AZs and multiple zones.
What is Recovery Point Objective (RPO) and Recover Time Objective (RTO) in the context of DB database failure?
RPO is the maximum acceptable time period of data loss. RTO is the maximum acceptable downtime.
E.g. you are running an app on a VM instance storing it’s data on a persitent data storage. You take snapshots every 48 hours and can manually bring it back up in 45 mins frmo the snapshot. Your RPO is 48 hours and RTO is 45 mins.
What is data consistency?
Synchronous data in multiple database instances
What does strong consistency mean and what does it mean for data speed?
Strong consistency means synchronous replication to all replicas. Because of constant replication, the data speed will be slow.
What does eventual consistency mean and when is it used?
Asynchroous replication. There’s a small lag of a few seconds before the change is made in all replicas. This is used when scalability is more important than data integrity e.g. for social media posts, a small lag doesn’t matter that much.
What is read-after-write consistency?
Inserts of data are immediately replicated but updates have eventual consistency
What are the 5 key considerations for choosing a database?
Fixed Schema or Schemaless?
Latency
Volume of transactions
Storage volume of data
What level of Atomicity and Consistency do you need in the data.
Atomicity is when there are more than 1 operation for a business event to take place like booking a seat on a flight. One operation is withdrawing funds and the other is reserving the seat. You shouldn’t have one without the other.
What are key characteristics of a relational database?
Has a predefined schema with tables and relationships between the tables.
Strong transactional capabilities e.g. ideal for banking apps.
Used for Online Transaction Processing and Online Analytics Processing
What are Azures relational database services?
Azure Managed SQL
Azure Managed MySQL
Azure Managed PostgreSQL
What is Azure’s analytics managed service?
Azure Synapse Analytics: A distributed data warehouse that provides big data analytics, data warehousing and data integration. Can run complex queries.
What is the key difference between OLAP and OLTP?
OLTP stores data in rows. This is because all the microtransactions can happen together in 1 row, they’re stored together.
OLAP stored data in columns which allows for high compressibility and better storage efficiency. Another difference is that you can store columns of data across different nodes or databases. This means you can execute simultaneous queries across different nodes.
What is the difference between relational and NoSQL databases? What is Azure’s NoSQL DB service called?
NoSQL has a flexible schema. There’s usually a trade off between “strong consistency and SQL features” to achieve “scalability and high performance”. E.g. Amazon’s ecom website is built on a NoSQL DB. Similar to social networks.
Azure’s NoSQL DB is Azure Cosmos DB.