Database Flashcards

(10 cards)

1
Q

What is the difference between SQL and NoSQL databases?

A

SQL databases are relational with structured schemas and ACID properties. NoSQL databases are non-relational, schema-flexible, and designed for horizontal scaling. SQL is good for complex queries; NoSQL for high-volume, flexible data.

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

What is database sharding?

A

Sharding is partitioning data across multiple database instances. Each shard contains a subset of data. It enables horizontal scaling by distributing load across multiple servers.

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

What is database replication?

A

Replication is copying data from one database server to others. Master-slave replication has one write node and multiple read nodes. Master-master allows writes on multiple nodes.

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

What is a database index?

A

An index is a data structure that improves query speed by creating pointers to data locations. It trades write performance and storage space for faster reads on indexed columns.

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

What is denormalization?

A

Denormalization is intentionally introducing redundancy in a database to improve read performance. It trades storage and update complexity for faster queries by reducing joins.

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

What are ACID properties?

A

ACID stands for Atomicity (all-or-nothing transactions), Consistency (valid state transitions), Isolation (concurrent transactions don’t interfere), and Durability (committed data persists).

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

What is eventual consistency?

A

Eventual consistency means that given enough time without new updates, all replicas will converge to the same value. It allows temporary inconsistencies for better availability and partition tolerance.

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

What is a connection pool?

A

A connection pool maintains a cache of database connections that can be reused. It reduces the overhead of creating new connections for each request and limits concurrent connections.

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

When would you choose NoSQL over SQL?

A

Choose NoSQL for: massive scale, flexible schemas, high write throughput, hierarchical data, or when eventual consistency is acceptable. Examples: user profiles, time-series data, real-time analytics.

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

What is database partitioning?

A

Partitioning divides a large table into smaller pieces based on criteria like range, hash, or list. Horizontal partitioning splits rows; vertical partitioning splits columns.

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