# Database

An organized store of persistent data managed so software can create, retrieve, update, protect, and recover information.

- Type: term
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/database/>)

## What it means

A database is an organized collection of data managed by a database system. The system provides mechanisms to store, query, update, constrain, secure, and recover data. Databases use different models—including relational, document, key-value, graph, and wide-column—whose structures and guarantees suit different access patterns.

## Why it matters

Product accounts, orders, content, permissions, and operational records must survive individual processes and remain usable as the product changes. Database choices influence correctness, latency, scalability, analytics, privacy, recovery, and the cost of future changes.

## When to use it

Use a database when structured or semi-structured product state must persist, be queried, shared, or recovered reliably. A file, object store, cache, search engine, or event log may be better for a narrower workload, and many systems combine specialized stores deliberately.

## How it works

1. Model the data, relationships, access patterns, retention needs, and correctness requirements.
2. Choose a database model and system whose guarantees and operational characteristics fit those needs.
3. Define structures, constraints, indexes, identities, and access controls.
4. Applications issue reads and writes through a query language, API, or driver.
5. The database coordinates storage, concurrency, durability, and retrieval according to its guarantees.
6. Operate backups, recovery tests, monitoring, capacity planning, migrations, and lifecycle policies.

## A practical example

A marketplace stores customers, listings, orders, and payment references in a database. Constraints prevent orders without valid customers, transactions preserve multi-step updates, indexes support common lookups, and tested backups protect against operator or infrastructure failure.

## Where it breaks

A database cannot correct a poor domain model, ambiguous ownership, unsafe access, or missing retention policy. Every system trades among consistency, availability, latency, query flexibility, cost, and operational complexity, and persistence does not replace tested backups.

## Common mistakes

- Choosing a database from popularity before defining access patterns and correctness needs.
- Treating the database as an integration interface shared freely by unrelated services.
- Assuming replication is a backup or that backups work without restoration tests.
- Keeping data indefinitely without privacy, retention, deletion, and archival decisions.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/database/#visualization-database>)

## Sources

1. [Architectural Fundamentals](<https://www.postgresql.org/docs/current/tutorial-arch.html>) — PostgreSQL Global Development Group · Official technical documentation
2. [Databases and Collections](<https://www.mongodb.com/docs/manual/core/databases-and-collections/>) — MongoDB · Official technical documentation

## Related topics

- [Relational Database](<https://wiki.soroush.uk/topic/relational-database/>)
- [NoSQL Database](<https://wiki.soroush.uk/topic/nosql-database/>)
- [Database Schema](<https://wiki.soroush.uk/topic/database-schema/>)
