Home › Other › Databases

Databases

A database is organized, durable storage you can query. The big choice is how structured your data is.

Any real application needs to keep data around between requests and restarts. A database is software built for exactly that: storing data durably and letting you query it efficiently.

Relational (SQL) databases

Data lives in tables with a fixed schema — defined columns and types. Tables relate to each other by keys, and you query with SQL. Examples: PostgreSQL, MySQL, SQLite.

They shine when:

Non-relational (NoSQL) databases

A family of databases that drop the rigid table model for flexibility or scale:

TypeStoresExample
DocumentJSON-like documentsMongoDB
Key/valueSimple pairs, very fastRedis
Wide-columnHuge, sparse tablesCassandra
GraphNodes and relationshipsNeo4j

ACID transactions

The guarantee that makes relational databases trustworthy. A transaction is Atomic (all or nothing), Consistent, Isolated (concurrent transactions do not corrupt each other), and Durable (once committed, it survives a crash). Moving money between accounts is the classic case.

Indexes

An index is a lookup structure that makes queries on a column fast — the difference between scanning a million rows and jumping straight to the one you want. The trade-off: indexes take space and slow down writes slightly, so you add them where you actually query, not everywhere.

Rule of thumb: start relational. It handles the vast majority of apps well, and you reach for NoSQL when you hit a specific need it solves — caching, massive scale, or genuinely schema-less data.

Keep reading