QA
Beginner LevelSystem Design & Architecture

When should you choose a Relational SQL database versus a NoSQL Document/Key-Value store?

❓ Interview Prompt: Compare SQL (Relational, ACID transactions, complex JOINs) vs NoSQL (Document/Key-Value, horizontal scaling, flexible schemas).

Evaluating database paradigms:

| Criteria | Relational SQL (Postgres, MySQL) | NoSQL (MongoDB, DynamoDB, Redis) |

|---|---|---|

| Data Structure | Structured tables with fixed schemas & Foreign Keys | Unstructured / JSON Documents / Key-Value pairs |

| ACID & Consistency | Strict ACID transactions & strong consistency | Eventual consistency; high write throughput |

| Scaling | Vertical scaling (Scale up); Read Replicas | Horizontal scaling (Scale out sharding out of box) |

| Best For | Financial transactions, e-commerce orders, relational data | High-velocity logs, user session caches, real-time feeds |

Code Implementation Example

json
{
  "selectedDatabase": "Relational SQL (PostgreSQL)",
  "rationale": "Requires multi-table ACID transactions and strict schema validation for user billing balances"
}
πŸ’‘Database selection rationale specification payload.
🎯 Interview Key Takeaway

Choose Relational SQL for complex ACID financial transactions, and NoSQL for high-throughput, horizontally scalable unstructured data.

#System Design#SQL vs NoSQL#Databases#Architecture#Beginner
Back to all System Design & Architecture Questions→

More System Design & Architecture Interview Questions

Beginner LevelSystem Design & Architecture

Explain the CAP Theorem and PACELC Theorem with real-world database examples.

Beginner LevelSystem Design & Architecture

What is Vertical Scaling (Scale Up) vs Horizontal Scaling (Scale Out)?

Beginner LevelSystem Design & Architecture

How do Load Balancers distribute traffic (Round Robin, Least Connections, IP Hash)?