RDBMS Flashcards

1
Q

“What is database replication?”

A

“Replication is the process of copying and maintaining database instances in multiple locations to ensure high availability and fault tolerance.”

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

“What is the difference between master-slave and master-master replication?”

A

“In master-slave replication, one master handles writes and multiple slaves handle reads. In master-master replication, multiple masters can handle both reads and writes.”

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

“Which type of replication introduces potential data conflicts?”

A

“Master-master replication, since multiple nodes can perform write operations, leading to synchronization challenges.”

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

“What is the main drawback of synchronous replication?”

A

“It ensures strong consistency but can introduce higher latency due to the need for immediate replication.”

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

“Which replication method prioritizes performance over consistency?”

A

“Asynchronous replication, as it allows data to be written to replicas with some delay.”

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

“How does replication improve read-heavy workloads?”

A

“By directing read queries to slave databases, reducing load on the master.”

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

“What is database sharding?”

A

“Sharding is the process of dividing a large database into smaller, more manageable pieces called shards, each containing a subset of the data.”

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

“How is data distributed in sharding?”

A

“Data is distributed based on a sharding key, such as user ID or geographic region.”

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

“What are the primary benefits of sharding?”

A

“It enables horizontal scaling, reduces query response times, and allows parallel processing.”

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

“What challenges can arise from sharding?”

A

“Uneven data distribution (hotspots), complex query routing, and expensive re-sharding operations.”

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

“What is the difference between sharding and replication?”

A

“Sharding partitions data across multiple nodes, while replication duplicates the same data across multiple nodes.”

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

“What is a common strategy for choosing a sharding key?”

A

“A key with even distribution across data, such as user IDs hashed to different shards.”

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

“What is database federation?”

A

“Federation involves breaking a database into multiple independent databases that operate separately but can be queried together if needed.”

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

“How does federation differ from sharding?”

A

“In federation, each database operates independently, while in sharding, shards are part of the same logical database.”

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

“What are the advantages of database federation?”

A

“Flexibility to use different database technologies, independent scaling, and better isolation between different datasets.”

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

“What are the drawbacks of database federation?”

A

“More complex query logic and increased operational overhead for managing multiple databases.”

17
Q

“Give an example of a real-world use case of federation.”

A

“An e-commerce platform where products, users, and orders are stored in separate databases.”

18
Q

“What is denormalization?”

A

“Denormalization is the process of adding redundant data to reduce the number of joins and improve read performance.”

19
Q

“What is the main advantage of denormalization?”

A

“Faster read queries by reducing the number of required joins.”

20
Q

“What is the main disadvantage of denormalization?”

A

“Increased storage requirements and potential data inconsistency.”

21
Q

“When should denormalization be used?”

A

“In read-heavy applications where performance is critical.”

22
Q

“How does denormalization impact data integrity?”

A

“It increases the risk of data inconsistency due to duplicated information.”

23
Q

“What is SQL tuning?”

A

“SQL tuning is the process of optimizing SQL queries to improve performance and reduce resource usage.”

24
Q

“What is an index in SQL?”

A

“An index is a database structure that improves the speed of data retrieval.”

25
Q

“Why should you avoid over-indexing?”

A

“Over-indexing increases storage overhead and slows down write operations.”

26
Q

“What does the EXPLAIN statement do?”

A

“It shows the execution plan of a query, helping identify performance bottlenecks.”

27
Q

“What is query caching?”

A

“Query caching stores frequently accessed query results to reduce database load.”

28
Q

“What is connection pooling?”

A

“Connection pooling reuses database connections to reduce overhead from creating new connections.”

29
Q

“How does replication improve fault tolerance?”

A

“It ensures data is available on multiple servers, reducing the risk of data loss if one server fails.”

30
Q

“What are primary keys and foreign keys?”

A

“A primary key uniquely identifies a record, while a foreign key links to a primary key in another table.”

31
Q

“What is the difference between vertical and horizontal scaling?”

A

“Vertical scaling increases hardware resources on a single server, while horizontal scaling adds more servers.”

32
Q

“What is the CAP theorem?”

A

“The CAP theorem states that a distributed system can only provide two out of three: Consistency, Availability, and Partition tolerance.”

33
Q

“What are some techniques to improve query performance?”

A

“Using indexing, partitioning, caching, and optimizing SQL queries.”

34
Q

“What is the difference between OLAP and OLTP databases?”

A

“OLTP is optimized for transactional queries, while OLAP is optimized for analytical queries.”

35
Q

“What is the difference between a clustered and non-clustered index?”

A

“A clustered index determines the physical order of data, while a non-clustered index does not.”

36
Q

“What is the role of a database optimizer?”

A

“The database optimizer chooses the most efficient way to execute a query.”

37
Q

“What is a database deadlock?”

A

“A deadlock occurs when two transactions hold locks that the other needs, causing a cycle of waiting.”

38
Q

“What is ACID compliance in databases?”

A

“ACID stands for Atomicity, Consistency, Isolation, and Durability, ensuring reliable transactions.”